从我的数据结构课程开始已经有一段时间了,我很难搞清楚这一点.我知道,如果我想要得到的价值从ArrayList
的Object[]
,我可以使用
nameOfArrayList.get(row)[col];
Run Code Online (Sandbox Code Playgroud)
但我似乎无法弄清楚,或在网上找到如何设置一个值.
我是否必须创建一个新对象并将其设置为nameOfArrayList.get(row)
,更改值然后使用
nameOfArrayList.set(row,Object[])?
Run Code Online (Sandbox Code Playgroud) 我一直在努力解决这个问题超过一个小时,我似乎无法找出为什么会出现这个错误.
int inp, count;
char numBuff[21];
count = 0;
while((inp=getchar()) != EOF) { // get Value (last field)
printf("input is '%c'\n", inp);
if (inp == '\n') break;
if (inp == ' ') {
continue;
}
numBuff[count++] = inp;
printf("go back through loop\n");
}
printf("Out!");
numBuff[count] = '\0';
Run Code Online (Sandbox Code Playgroud)
如果我输入1013,我会得到以下内容
input is '1'
go back through loop
input is '0'
go back through loop
input is '1'
go back through loop
input is '3'
go back through loop
input is '
' …
Run Code Online (Sandbox Code Playgroud)