Originally Posted by
Salem
Those results don't come from that code.
And naming your function 'add' when it returns 'max' is utterly misleading.
main.c
Code:
#include<stdio.h>
#include"file1.h"
int main()
{
int result;
result = max (4, 5);
printf("%d\n", result);
return 0;
}
file1.c
Code:
extern int max(int a, int b){
return a > b ? a : b;
}
file1.h
Code:
extern int max(int a, int b);
gcc file1.c main.c
warning: implicit declaration of function 'max' [-Wimplicit-function-declaration]
result = max (4, 5);
^~~
x=1 x=4
how to remove warning in code ?
why result is wrong?