inline

this code works properly

inline int add(int x,int y)
{
return x+y;
}

int main(void)
{
int x=0,y=0,z=0;
printf("enter two number");
scanf("%d%d",&x,&y);
z=add(x,y);
printf("%d",z);
while(!kbhit());
return 0;
}

but when we write code like this it does not give any output

int main(void)
{
int x=0,y=0,z=0;
printf("enter two number");
scanf("%d%d",&x,&y);
z=add(x,y);
printf("%d",z);
while(!kbhit());
return 0;
}
inline int add(int x,int y)
{
return x+y;
}


Last edited on
Neither the first code nor the second code generates any output.:) So for your examples it is totally unimportant where the function is defined. It is not used.
@vald from moscow
I just do not provide the implmentation detail in main function I just want to know that when I provide function defnition before main then it works properly but when I provide function defnition after main then it did not give any output

do not goto the calling of add() function in main()
I am sorry but we are telepathists that to guess what is the reason.
Topic archived. No new replies allowed.