T
Tarique
Hello.Can anyone please explain why the output of the following
code is Hello? No header file is included and the code works (Compiled
as a 'c' code with the strictest warning level on Visual C++ 2008(express) !
I get the two warnings :
1.warning C4431: missing type specifier - int assumed. Note: C no longer
supports default-int
2.warning C4013: 'printf' undefined; assuming extern returning int
main()
{
char *c="Hello";
printf(c,34,c,34);
}
The code prints Hello irrespective of the integer values used in the
printf statement(both +ve and -ve)
______________________________________________________________________
Secondly.
#include<stdio.h>
main() {
char*c="\\\"#include<stdio.h>%cmain(){char*c=%c%c%c%.102s%cn%c
;printf(c+2,c[102],c[1],*c,*c,c,*c,c[1]);exit(0);}\n";
printf(c+2,c[102],c[1],*c,*c,c,*c,c[1]); /*What about this line?*/
exit(0);
}
Can anyone explain what happens in the printf statement?
Thank You
code is Hello? No header file is included and the code works (Compiled
as a 'c' code with the strictest warning level on Visual C++ 2008(express) !
I get the two warnings :
1.warning C4431: missing type specifier - int assumed. Note: C no longer
supports default-int
2.warning C4013: 'printf' undefined; assuming extern returning int
main()
{
char *c="Hello";
printf(c,34,c,34);
}
The code prints Hello irrespective of the integer values used in the
printf statement(both +ve and -ve)
______________________________________________________________________
Secondly.
#include<stdio.h>
main() {
char*c="\\\"#include<stdio.h>%cmain(){char*c=%c%c%c%.102s%cn%c
;printf(c+2,c[102],c[1],*c,*c,c,*c,c[1]);exit(0);}\n";
printf(c+2,c[102],c[1],*c,*c,c,*c,c[1]); /*What about this line?*/
exit(0);
}
Can anyone explain what happens in the printf statement?
Thank You