我的字符串数组有问题 [英] Problems with my string array

查看:73
本文介绍了我的字符串数组有问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧..我有一个像这样设置的程序..


#include< iostream.h>

#include < lvp / string.h>


int main()


{

字符串名称[2] ;

}


现在,这不是整个程序。当我尝试在数组中引发## 2时,我从编译器中得到一个错误,即存在堆栈器错误并且程序冻结。任何人都可以告诉我如何解决这个问题。我的问题可能在我的程序中某处,所以请问你是否要2看到整个事情。


谢谢,onorinbejasus

解决方案

< blockquote>我不知道你要做什么,但如果你做String array [2]然后做数组[2] =""你将得到一个错误,因为数组[2]中没有任何内容。长度为2的数组在数组[0]处有两个索引,在数组[1]处有一个索引。



现在,这不是可能整个程序。当我尝试在数组中引发## 2时,我从编译器中得到一个错误,即存在堆栈器错误并且程序冻结。任何人都可以告诉我如何解决这个问题。我的问题可能在我的程序中某处,所以请问你是否想要2看到整个事情。



如果RedSon告诉你什么没有响铃,那么是的,让我们看看整个事情。没有足够的信息可以进行任何分析。


哦,并清除一些语义,你的编译器没有生成堆栈错误信息,你的程序是。虽然代码中没有明确说明,但编译器会输入隐式代码来告诉您程序中存在错误。


Adrian


我正在从这些数组读取数据,请注意它只是给我带来问题的字符串。这个程序100%工作,直到我提高字符串变量数组中的数字...继承人代码

展开 | 选择 | 换行 | 行号


ok.. i have a program that''s set up like this..

#include <iostream.h>
#include <lvp/string.h>

int main()

{
String name[2];
}

now, this isnt may whole program. When i try to raise the ##2 in the array i get an error from my compiler that there is a stacker error and the program freezes. Can anyone tell me how i can fix this. my problem might be somewhere in my program so please ask if you want 2 see the whole thing.

Thanks, onorinbejasus

解决方案

Im not sure what you are trying to do but if you do String array[2] and then do array[2] = "" you are going to get an error because nothing exists at array[2]. Arrays that are of length two have two indexes one at array[0] and one at array[1].


now, this isnt may whole program. When i try to raise the ##2 in the array i get an error from my compiler that there is a stacker error and the program freezes. Can anyone tell me how i can fix this. my problem might be somewhere in my program so please ask if you want 2 see the whole thing.

If what RedSon has told you doesn''t ring any bells, then yeah, let?s see the whole thing. There is not enough information to do any sort of analysis.

Oh and clear up some semantics, your compiler isn''t generating the stack error message, your programme is. Though not explicitly stated in your code, it is implicit code put in by the compiler to tell you that there is a bug in your programme.

Adrian


im reading data from a into these arrays, note that its only the strings that are giving me problems. this program works 100% until i raise the number in the string variable array... heres the code

Expand|Select|Wrap|Line Numbers


这篇关于我的字符串数组有问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆