#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> #include<string.h> int main11() { system("pause"); return 0; } void main22() { char *p1 = NULL; p1 = 0x00077; strcpy(p1, "11111222"); system("pause"); return ; } void main() { char buf[128]; int i; int j = 0; char *p1 = NULL;//c可以在栈上分配内存 char *p2 = NULL; p1 = &buf[0]; //不断的改变p1的值 相当于不断的改变指针的指向。 p1 = &buf[1]; p1 = &buf[2]; for ( i = 0; i < 10;i++) { p1 = &buf[i]; } p2 = (char *)malloc(100); strcpy(p2,"abdafgadf121313"); for ( i = 0; i < 10; i++) { p1 = p2 + i; printf("%c ", *p1); } printf("hello....\n"); system("pause"); return; }