C-printf错误
我试图在24小时内从Sam的Learn C中编译一个示例 当我尝试编译以下代码时,出现了一个错误:C-printf错误,c,function,main,C,Function,Main,我试图在24小时内从Sam的Learn 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;
/* 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;
}
提前感谢。您在程序中对字符串使用了错误的引号。您的
“
应该是”
您在程序中对字符串使用了错误的引号。您的“
应该是”是因为错误的双引号
printf(“The addition of 5 and 12 is %d.\n”, sum);
到
因为错误的双qoute
printf(“The addition of 5 and 12 is %d.\n”, sum);
到
不要在代码中使用“智能引号”!!!对于字符串分隔符,请使用普通的旧引号。对于字符串分隔符,请使用普通的旧引号。对于字符串分隔符,请使用普通的旧引号。对于字符串分隔符,请使用普通的旧引号您可能可以复制/粘贴:)您刚刚弄错了引号字符,请将其更改为:
printf("The addition of 5 and 12 is %d.\n", sum);
我不知道你用的是什么键盘,但通常“字符在'2'字符之上(我使用的是意大利键盘,所以这可能与你的国家不同)。
你肯定会在某个地方找到那个角色。
如果我没有弄错的话,它在ASCII表中是34,所以在windows上,您可以通过按alt+34来获得它。您刚刚弄错了引号字符,请将其更改为:
printf("The addition of 5 and 12 is %d.\n", sum);
我不知道你用的是什么键盘,但通常“字符在'2'字符之上(我使用的是意大利键盘,所以这可能与你的国家不同)。
你肯定会在某个地方找到那个角色。
如果我没有弄错的话,它在ASCII表中是34,所以在windows上,您可以通过按alt+34来获得它。我看到您的错误,因为相同的字符。。查看您的代码
printf(“The addition of 5 and 12 is %d.\n”, sum);
尝试更改为:
printf("The addition of 5 and 12 is %d.\n", sum);
你能看到区别吗?Qoute“它必须是”我看到你的错误,因为相同的字符。看到你的代码了吗
printf(“The addition of 5 and 12 is %d.\n”, sum);
尝试更改为:
printf("The addition of 5 and 12 is %d.\n", sum);
您能看到差异吗?Qoute“它必须是”看起来您的“quote”字符不正确。您使用的是“而不是默认值”,并且看起来您从某个地方复制了代码。看起来您的“quote”字符不正确。您使用的是“而不是默认值”看起来你从某处复制了代码。。