数组形式的首地址不可执行++和–操作
虽然数组名代表首地址,但是不可以像指针一样执行++
和--
操作。
数组形式的首地址不可执行++和–操作
lvalue required as increment operand
#include <stdio.h>
#include <stdlib.h>
int main()
{
char temp[100];
*temp = '1';
temp++;
// 这段代码是错误的,数组名代表的指针是不可以执行++操作的。
// lvalue required as increment operand
//如上同
int temp[100];
*temp = 1;
temp++;
}