C语言有关指针的题目
答案选择 B
A是数组首地址,所以数组的第3个元素是 (首地址 2) 即 ( p=A 2 )
A的第3个元素也可以这样表示 A[2], 要使p指向它,就用取地址符,即 & ,所有也可以这样 p=&A[2];
所以答案是 B .
c语言的指针题目
#include
#include
void main()
{char c[128],str[128];
int m;
char * p;
p=c;
puts("please enter the string:
");
gets(c);
puts("enter the number:
");
scanf("%d",&m);
if(m>strlen(c)) puts("error");
else {
strcpy(str,p m-1);
puts(str);
}