c - 符号常量

标签 c

#include<conio.h>
#include<stdio.h>
#define abc 7

int main()
{

int abc=1;

printf("%d",abc);

getch();

return 0;
}

为什么这个程序会出现编译时错误

最佳答案

您正在分配无效的 7=1。由于您已将 abc 定义为 7,因此预处理器会翻译以下行:

int abc=1;

到:

int 7=1;

这是 C 中的语法错误(我的 gcc语法错误在数字常量之前)。

关于c - 符号常量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2482551/

相关文章:

c - MPI_send 和 MPI_receive 函数卡住了

C菜鸟 : Define size of a char array while copying contents of char* into it

Java native 接口(interface) : Object Passing

c - linux 文件创建和 umask()

c - 为什么这个数组在c中不会停止循环

c - 这个程序如何创建僵尸进程?

c - 在树中查找特定值

c - 用空格分割字符串,并使用指针数组将一个单词添加到分割字符串的结果中

c - 将多个目录和文件包含到 makefile 中

c - autoconf 实际上为 AC_CHECK_FUNCS 功能运行了什么