|
直接上测试代码
- #include <stdio.h>
- 2 #include <stdlib.h>
- 3 int main(void)
- 4 {
- 5 void swap (int *a, int *b);
- 6 void bbb(void);
- 7 int a=2;
- 8 int c=3;
- 9 swap (&a, &c);
- 10 return 0;
- 11 }
- 12 void bbb(void)
- 13 {
- 14 int a=2;
- 15 int b=3;
- 16 swap (&a, &b);
- 17 }
- 18 void swap (int *a, int *b)
- 19 {
- 20 *a ^= *b;
- 21 *b ^= *a;
- 22 *a ^= *b;
- 23 }
- ~
复制代码
gcc报错
- gcc test.c
- test.c: In function ‘bbb’:
- test.c:16: error: incompatible implicit declaration of function ‘swap’
- test.c:5: note: previous implicit declaration of ‘swap’ was here
复制代码 |
|