我正在试着在24小时内编译一个来自Sam的学习C语言的例子。
当我尝试编译以下代码时,我得到一个错误:
/* 03L02.c: Calculate an addition and print out the result */
#include <stdio.h>
/* This function adds two integers and returns the result */
int integer_add( int x, int y )
{
int result;
result = x + y;
return result;
}
int main()
{
int sum;
sum = integer_add(5, 12);
printf(“The addition of 5 and 12 is %d.\n”, sum);
return 0;
}这是我的编译器给出的错误:
In function main
stray "\147\' in program
The undeclared identifier is declared only once
for each function it appears in
syntax error before addition
stray "\' in program
stray "\148' in program提前谢谢。
发布于 2012-12-03 19:44:12
您在程序中对字符串使用了错误的引号类型。当它应该是"时,你有“。
发布于 2012-12-03 19:46:51
您只是弄错了引号字符,将其更改为:
printf("The addition of 5 and 12 is %d.\n", sum);我不知道你使用什么键盘,但通常“字符在'2‘字符之上(我使用的是意大利语键盘,所以可能对你的国家不同)。”
你肯定会在某个地方找到这个角色的。
如果我没记错的话,它在ASCII表中是34,所以在windows上你可以通过按alt+34来获取它。
发布于 2012-12-03 19:45:06
因为错误的双队列
printf(“The addition of 5 and 12 is %d.\n”, sum);至
printf("The addition of 5 and 12 is %d.\n”, sum);https://stackoverflow.com/questions/13682518
复制相似问题