69,382
社区成员
发帖
与我相关
我的任务
分享
printf("中文");
#include <stdio.h>
int main()
{
printf("%s",25105);
return 0;
}
yane@yane-desktop:~/桌面$ gcc -Wall x.c -o x
x.c: 在函数‘main’中:
x.c:4:1: 警告: 格式 ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat]
yane@yane-desktop:~/桌面$ ./x
段错误
yane@yane-desktop:~/桌面$ gcc -Wall x.c -o x
x.c:2:1: 警告: 返回类型默认为‘int’ [-Wreturn-type]
x.c: 在函数‘main’中:
x.c:6:1: 警告: 在有返回值的函数中,控制流程到达函数尾 [-Wreturn-type]
yane@yane-desktop:~/桌面$ ./x
�Ұ��
yane@yane-desktop:~$ cd /home/yane/桌面/
yane@yane-desktop:~/桌面$ gcc -Wall x.c -o x
x.c:3:1: 警告: 返回类型默认为‘int’ [-Wreturn-type]
x.c: 在函数‘main’中:
x.c:5:5: 错误: 未知的类型名‘wchar_t’
x.c:8:1: 警告: 在有返回值的函数中,控制流程到达函数尾 [-Wreturn-type]
#include <stdio.h>
#include <locale.h>
main()
{
wchar_t s[]={ 25105, 29233 ,20320 ,0};//怎么这里是这样的数字?
setlocale( LC_ALL, "" );
printf("%ls",s);
}
char p[] = {0xce, 0xd2, 0xb0, 0xae, 0xc4, 0xe3, 0};
#include <stdio.h>
#include <locale.h>
main()
{
wchar_t s[]={ 25105, 29233 ,20320 ,0};
setlocale( LC_ALL, "" );
printf("%ls",s);
}