一、使用char 和 unsigned char打印结果
#include <stdio.h>
int main()
{
char *a = "abcd"; //无警告
signed char *b = "abcd"; //编译报警告 ”Initializing 'signed char *' with an expression of type 'char [5]' converts between pointers to integer types with different sign”
unsigned char *c = "abcd"; //编译报警告 "Initializing 'unsigned char *' with an expression of type 'char [5]' converts between pointers to integer types with different sign"
printf("a-----%s\n",a);
printf("b-----%s\n", b);
printf("c-----%s\n", c);
system("pause");
return 0;
}
执行结果:
a-----abcd
b-----abcd
c-----abcd
请按任意键继续. . .
二、typedef int nint32_t的使用
其实就是简单定义了类型,出现这种情况一般是取值范围不一样罢了!
这样的定义方式有很多:
typedef int nint32_t;
typedef unsigned int uint32_t;
typedef unsigned short uint16_t;
下面是一个例子:
#include <stdio.h>
int main()
{
typedef int nint32_t;
nint32_t xyz;
xyz = 16;
printf("xyz-----%d\n", xyz);
system("pause");
return 0;
}
执行结果: