字符串常量强制转换为字符指针
时间:2014-05-09 09:37:30
收藏:0
阅读:414
一、实验代码
#include <stdio.h> void print(char s[]); int main() { print((char *)"abcdef"); return 0; } void print(char s[]) { printf("%s\n",s); }
二、实验结果
输出:abcdef
三、调试现象
三、结论
字符串常量强制转换为字符指针,是将字符串常量的地址作为这个指针值。至于这个常量的位置还不太确定。
评论(0)