How to resolve “conflicting types error” in C?

后端 未结 7 622
情话喂你
情话喂你 2021-01-27 16:33

For the following C code (for swapping two numbers) I am getting the \"conflicting types\" error for swap function:

#include 
#includ         


        
相关标签:
7条回答
  • 2021-01-27 17:20

    You need to declare swap before using it. For example, put swap above main, or add a prototype for swap like this:

    void swap(void *,void *,int);
    int main () 
    

    Incidentally main should be int not void and usually it returns the value zero, unless there is an error.

    0 讨论(0)
提交回复
热议问题