+ -
当前位置:首页 → 问答吧 → c写入指针的指针到文件如何实现?

c写入指针的指针到文件如何实现?

时间:2010-08-14

来源:互联网

#include <stdio.h>
int main (void)
{
unsigned int un = 3000000000;
short end = 200;
long big = 65537; long long evrybig = 12345678908642;
printf ("un = %u and not %d\n", un, un);
printf ("end = %hd and %d\n", end, end);
printf ("big = %ld and not %hd\n", big, big);
printf ("verybig = %lld and not %ld\n", verybig, verybig);
return 0;
}

这是我的源代码,接着我进行编译,就出现以下错误:

print2.c: In function 'main':
print2.c:4: warning: this decimal constant is unsigned only in ISO C90
print2.c:6: warning: integer constant is too large for 'long' type
print2.c:9: warning: format '%hd' expects type 'int', but argument 3 has type 'long int'
print2.c:10: warning: format '%ld' expects type 'long int', but argument 3 has type 'long long int'

希望谁能指点一下,谢谢了。

作者: wackyjason   发布时间: 2010-08-14

没有报错,只是警告,还是可以运行
警告内容:数据类型不一样

作者: iSIX   发布时间: 2010-08-14

通过了 只是warning而已

作者: pocoyo   发布时间: 2010-08-14

那我需要更改一些什么设置来回应这些警告吗?这些警告重要吗?

我这会又编写了以下这个程序:
#include <stdio.h>
int main (void)
{
char ch;
printf ("Please enter a character.\n":);
scanf ("%c", &ch);
printf ("The code for %c is %d.\n", ch, ch);
return 0;
}

在运行的过程中我输入的字母“c”,在书上为(ASCII码)环境下,反应为:
The code for c is 67.
然而在我的电脑上却是:
The code for c is 99.

这说明我是使用的什么字符集呢?

作者: wackyjason   发布时间: 2010-08-14

#include <stdio.h>
int main (void)
{
unsigned int un = 3000000000;
short end = 200;
long big = 65537; long long evrybig = 12345678908642;
printf ("un = %u and not %d\n", un, un);
printf ("end = %hd and %d\n", end, end);
printf ("big = %ld and not %hd\n", big, big);
printf ("verybig = %lld and not %ld\n", verybig, verybig);
return 0;
}

这是我的源代码,接着我进行编译,就出现以下错误:

print2.c: In function 'main':
print2.c:4: warning: this decimal constant is unsigned only in ISO C90
print2.c:6: warning: integer constant is too large for 'long' type
print2.c:9: warning: format '%hd' expects type 'int', but argument 3 has type 'long int'
print2.c:10: warning: format '%ld' expects type 'long int', but argument 3 has type 'long long int'

希望谁能指点一下,谢谢了。

作者: wackyjason   发布时间: 2010-08-14

没有报错,只是警告,还是可以运行
警告内容:数据类型不一样

作者: iSIX   发布时间: 2010-08-14

通过了 只是warning而已

作者: pocoyo   发布时间: 2010-08-14

那我需要更改一些什么设置来回应这些警告吗?这些警告重要吗?

我这会又编写了以下这个程序:
#include <stdio.h>
int main (void)
{
char ch;
printf ("Please enter a character.\n":);
scanf ("%c", &ch);
printf ("The code for %c is %d.\n", ch, ch);
return 0;
}

在运行的过程中我输入的字母“c”,在书上为(ASCII码)环境下,反应为:
The code for c is 67.
然而在我的电脑上却是:
The code for c is 99.

这说明我是使用的什么字符集呢?

作者: wackyjason   发布时间: 2010-08-14