首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

C语言strcat的有关问题.跟指针有关

2012-02-24 
C语言strcat的问题.跟指针有关.C/C++ code#include stdio.h#include ctype.h#include stdlib.hint m

C语言strcat的问题.跟指针有关.

C/C++ code
#include <stdio.h>#include <ctype.h>#include <stdlib.h>int main(){    char str1[]="china ";    char str2[]="is good\n";    char *p=strcat(str1,str2);     while(*p!='\0'){       putchar(*(p++));                    }    system("PAUSE");    return 0;    }

   

//实验证明,可以办到 
但是我就不明白为什么用int *p 来接收地址就不行?

int 型来存放地址 然后不是一样能读取吗?地址不是数字吗?

[解决办法]
一楼正解!
不同类型的指针加1后的值不同。

热点排行