error: conflicting types for function

the two most common reasons for the conflict types of error

first, mismatch of return type b/w  function prototype declaration and the function declaration

the second is a mismatch of function parameters type b/w function prototype declaration and the function declaration

let’s see an example

#include <stdio.h>
#include <stdlib.h>
 int calsum(int x, int y);//function prototype declaration
int main()
    int a=1,b=2,sum;
     sum=calsum(a,b); // function call
    return 0;
 int calsum(int x, int y) //function declaration
    int d;

always make sure your function prototype declaration and function declaration should match with the same number of arguments with the same type and the same return type of function

Mohammed Anees

Hey there, welcome to aneescraftsmanship I am Mohammed Anees an independent developer/blogger. I like to share and discuss the craft with others plus the things which I have learned because I believe that through discussion and sharing a new world opens up

Leave a Reply

Your email address will not be published.