一、实验代码

#include <stdio.h>

void print(char s[]);

int main()
{
    print((char *)"abcdef");
    return 0;
}

void print(char s[])
{
    printf("%s\n",s);
}

二、实验结果

输出:abcdef

三、调试现象

三、结论

  字符串常量强制转换为字符指针,是将字符串常量的地址作为这个指针值。至于这个常量的位置还不太确定。

 

posted on 2014-05-08 20:43  amanlikethis  阅读(1736)  评论(0编辑  收藏  举报