K
karthikbalaguru
Hi ,
I find that the below program works without the inclusion
of the stanard input/output library.
I understand that we mandatorily need a valid prototype in scope for
functions like printf to avoid undefined behaviour and
that can be done through #include <stdio.h> only.
But, the below code runs perfectly well without those
statment. Strange !!
int main(void)
{
int a = 1,b;
char t[10];
printf(a ?"one \n" : "zero \n") ;
scanf("%d",&b);
printf("b = %d \n",b);
strcpy(t,"Hello");
printf("%s \n",t);
return 0;
}
It works without the famous #include<stdio.h> .
Strange ? How is it possible ?
I use Visual C++ 2008 express edition for C compilation
and debugging.
Any ideas ?
Thx in advans,
Karthik Balaguru
I find that the below program works without the inclusion
of the stanard input/output library.
I understand that we mandatorily need a valid prototype in scope for
functions like printf to avoid undefined behaviour and
that can be done through #include <stdio.h> only.
But, the below code runs perfectly well without those
statment. Strange !!
int main(void)
{
int a = 1,b;
char t[10];
printf(a ?"one \n" : "zero \n") ;
scanf("%d",&b);
printf("b = %d \n",b);
strcpy(t,"Hello");
printf("%s \n",t);
return 0;
}
It works without the famous #include<stdio.h> .
Strange ? How is it possible ?
I use Visual C++ 2008 express edition for C compilation
and debugging.
Any ideas ?
Thx in advans,
Karthik Balaguru