一个c程序报错,求大神解释。。
#include <stdio.h>#include <string.h>
struct stmp {
int len;
char s[44];
};
struct sock {
struct stmp stmp;
#define len stmp.len
#define s stmp.s
};
int main() {
struct sock sock;
struct stmp tmp={1,"hello"};//此处可以
//tmp.len = 1;①
//strcpy(tmp.s, "hello");②
memcpy(&sock, &tmp, sizeof(tmp));
printf("len[%d] s[%s]\n", sock.len, sock.s);
return 0;
}
为什么①和②会报错,求大神解释。