字符串常量,无符号字符,局部变量

/*************************
    字符串常量,无符号字符,局部变量
****************************/
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
    char (*p)[]="wqrewgrryh";    //警告:const char * 类型的值不能用于初始化 char (*)[]类型的实体
    char a;
    //*((char *)p)=89;
    //p=&a;
    char *pa;
    int i=0;
    unsigned char c = 0x8f;     //下面printf语句输出143,上一语句去掉unsigned后,输出-113
    printf("c is %d. \n",c);    //
    for( i=0;i<3;i++)
    {
            int j=12;
            static int aa;
            pa="qwerty";
            printf("%d",j);
    }
    printf("%s",pa);    //输出qwerty,说明qwerty未释放,因为它是字符串常量,没有存储在堆栈区
    //printf("%d",j);    //错误,j未定义,说明j已经释放
    system("PAUSE");
    return 0;
}

转载于:https://my.oschina.net/libowen/blog/93279

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值