第一行函数名称之前的预期标识符
expected identifier before the name of the function on first line
我有一个代码:
void switch (int *a, int *b)
{
int temp = *a;
*a = *b;
*b = temp;
}
这是我通过这个.h文件包含在其他.c文件中的函数:
#ifndef SWITCHINT_H
#define SWITCHINT_H
void switch (int *a, int *b);
#endif
但是控制台打印出:
switchInt.c:1:5: error: expected identifier or ‘(’ before ‘switch’
void switch (int *a, int *b);s
switchInt.h:4:6: error: expected identifier or ‘(’ before ‘switch’
void switch (int *a, int *b);
我该怎么办?
错误是由于 reserved 函数名称 ("switch")
感谢Fiddling Bits的帮助!
P.S:对不起,我太盲目了:(
我有一个代码:
void switch (int *a, int *b)
{
int temp = *a;
*a = *b;
*b = temp;
}
这是我通过这个.h文件包含在其他.c文件中的函数:
#ifndef SWITCHINT_H
#define SWITCHINT_H
void switch (int *a, int *b);
#endif
但是控制台打印出:
switchInt.c:1:5: error: expected identifier or ‘(’ before ‘switch’
void switch (int *a, int *b);s
switchInt.h:4:6: error: expected identifier or ‘(’ before ‘switch’
void switch (int *a, int *b);
我该怎么办?
错误是由于 reserved 函数名称 ("switch")
感谢Fiddling Bits的帮助!
P.S:对不起,我太盲目了:(