#include<stdio.h>
int main()
{
int i;
i = 10;
print(i);
return 0;
}
void print(int a)
{
printf(“%d\n”,a);
}
output:warning: conflicting types for ‘print’ [enabled by default]
note: previous implicit declaration of ‘print’ was here
#include<stdio.h>
int main()
{
int i;
i = 10;
print(i);
return 0;
}
void print(int a)
{
printf(“%d\n”,a);
}
output:warning: conflicting types for ‘print’ [enabled by default]
note: previous implicit declaration of ‘print’ was here
EmbLogic Research & Competency Development Labs
Phone: +91 9818467776, 8527567776, 9650467776
Email: info@emblogic.com
Copyright © EmbLogic Embedded Technologies Pvt. Ltd.
You have to declare the function before you use it. If the function name appears before its declaration, C compiler will follow certain rules and makes the declaration itself. If it is wrong, you will get that error.
You have two options: (1) define it before you use it, or (2) use forward declaration without implementation
remove void from definition of the function, and warning will not occur.
this warning is due to type mismatch, function that you were calling returns int and function that you have defined returns void..
That is a problem. If you dont use void, by default function will return integer, so there will not be any warning.
cheers..!!