#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
char *p = NULL;
char *q = NULL;
int i = 0;
q = (char *)malloc(100); //q分配100个字节在堆里,q指向0x11这片空间
if (q == NULL)
{
return -1;
}
strcpy(q, "abcdefg"); //把abcdefg拷贝到q所指向的内存空间
printf("\n");
for (i = 0; i < strlen(q); i++)
{
p = q + i;
printf("%c ", *p);
}
printf("\n");
system("pause");
return 0;
}