-1

我有一个代码:

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);

我应该怎么办?

4

1 回答 1

0

由于函数的保留名称(“switch”)而发生错误

感谢Fiddleing Bits的帮助!

PS:我很抱歉这么盲目:(

于 2018-11-06T15:33:20.320 回答