gpt4 book ai didi

c - 在字符串中使用 printf

转载 作者:行者123 更新时间:2023-11-30 17:34:14 25 4
gpt4 key购买 nike

我正在尝试输入 printf("在字符串中

#include<stdio.h>
#include<conio.h>
main()
{
char print1="printf(\""; \\i used \ as an escape sequence for "
printf("%s",print1);
getch();
}

但它给了我以下警告:

5 [Warning] initialization makes integer from pointer without a cast

当我执行代码时,输​​出是:<null>

最佳答案

这一行

char print1="printf(\""; \\i used \ as an escape sequence for "

应该是

 char *print1="printf(\""; \\i used \ as an escape sequence for "

或者也许

char print1[]="printf(\""; \\i used \ as an escape sequence for "

关于c - 在字符串中使用 printf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23454626/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com