为什么我的 Xcode 方言更改没有生效?
我刚刚开始接触 C 语言中的字符串,我的老师在 Windows 上使用 CodeBlocks,而我正在使用 Xcode。 他向我介绍了这一点:
#include <stdio.h>
#include <string.h>
int main()
{
char name[15];
printf("Enter your name ");
scanf("%[^\n]s\n",&name);
printf("Welcome, %s !",name);
size_t a=strlen(name);
printf("Your name is %zu\n",a);
strupr(name);
printf("\n")
}
但是当我在 Xcode 中执行相同的程序时,strupr(name);
不起作用并显示错误:
函数“strupr”的隐式声明在 C99 中无效。
所以我回到SO寻找可能的解决方案。有一个说要转到语言方言并将其更改为C11。我这样做了,但仍然无法执行,显示相同的错误消息。我需要做其他事情才能让它运行吗?
谢谢
I am just getting introduced to string in C, and my teacher uses CodeBlocks on windows and I'm using Xcode.
He introduced me to this:
#include <stdio.h>
#include <string.h>
int main()
{
char name[15];
printf("Enter your name ");
scanf("%[^\n]s\n",&name);
printf("Welcome, %s !",name);
size_t a=strlen(name);
printf("Your name is %zu\n",a);
strupr(name);
printf("\n")
}
But when I do this same program in Xcode, strupr(name);
doesn't work and shows the error:
Implicit declaration of function 'strupr' is invalid in C99.
So I came back to SO to look for possible solutions. There was one where it said to go to language dialect and change it to C11. I did it, but it still would not execute, showing the same error message. Do I need to do something else to make it run?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论