这是个程序设计上的问题。说白了,就是对于非数组和指针类型的变量,不能用[]这样的下标符号。例如:int x;x[1]=10;就会显示这种错误信息(在C语言中)subscript requires array or pointer type下标需要数组或指针类型很高兴为你解答!如有不懂,请追问。 谢谢!
意思是对于非数组和指针类型的变量,不能用[]这样的下标符号。下标表达式,形如p[i],等价于*(p+i),其中+是指针加法,数值上相当于+ sizeof(*p) * i。“多维”的下标表达式如p[i][j],由结合性等价于(p[i])[j],即*(p[i]+j),也就是*(*(p+i)+j)。[]和一元*操作符的操作数...
【题目】C++程序数组引用问题:subscript requi res array or pointer type/*在文件in.dat中有200组数据,每组有3个数,每个数均是三位数.函数ReadDat()读取这200组数据存放到结构数组a a中请编制函数jsSort(),其函数的功能是要求在200组数据中找出条件为每组中的第二个数大于第一个数加第三个数的之和其中...
C语言subscript requires array or pointer type 错误怎么改呀?这个错误通常是因为你在使用下标访问一个非...
关于错误 "error c2109: subscript requires array or pointer type" 的解答 1. 理解错误信息 错误信息 "error c2109: subscript requires array or pointer type" 指出在使用下标(即 [] 操作符)时,所操作的变量必须是数组或指针类型。如果尝试对非数组或非指针类型的变量使用下标操作,编译器将抛出此错误。 2....
include <stdio.h> include <string.h> char func (char t[])//定义成数组 { int i,j,k,n,v;for(i=0,n=0;i<100;i++,n++){ if(t[i]=='\0')} for(i=0,j=n,k=0;i<=(n+1)/2;i++,j--){ if(t[i]==t[j-1])} if(k==(n+1)/2){ v=0;} else { v=...
你下面这两句写错了:for (i=0;i<=m;i++)for (j=0;j<=k;j++)应该是:for (i=0;i<m;i++)for (j=0;j<k;j++)循环里面的下标控制如果从0开始,后面就应该用小于号。如果用等于号,就会造成数组下标越界,也就是“subscript requires array or pointer type”错误。
I got this assignment the other day in which I had to convert this project I had done from subscript notation to pointer notation. I dont really understand the syntax used for pointer notation. My program below (using subscript notation) works fine but I dont really know exactly how to go...
为什么会出现subscript requires array or pointer type?最后提一句,其实这个代码改成 inta[i];就对了...
ahoney and fennel blackened chicken wings, and sesame-glazed star anise and cinnamon-braised red pork. 蜂蜜和茴香变黑的鸡翼和给芝麻上釉的八角茴香和桂香被炖的红色猪肉。[translate] asubscript requires array or pointer type 下标要求列阵或尖类型[translate]...