#include <stdio.h>
#include <string.h>
#define F(X,Y) (X)*(Y)
struct s{
int x;
int y;
}data[2]={{10,100},{20,200}};
int main(void)
{
char str[][20] = {{"Hello"},{"Beijing"}};
char *ptr = str[0];//等同于char *ptr = *str;
printf("strlen(p+20) = %d\n",strlen(ptr+20));
//ptr+20之后,指针ptr指向了字符串“Beijing”;
int a = 3, b=4;
printf("%d\n",F(a++,b++));
struct s *p = data;
printf("%d\n",++(p->x));
return 0;
}
运行结果:
strlen(p+20) = 7
12
11