main() { int i; clrscr(); printf("%d", &i)+1; scanf("%d", i)-1; }
A) Runtime error. Access violation B) Compile error. Illegal syntax C) None of the above D) Runtime error Explanation: printf( ) prints address/garbage of i, scanf() dont have & sign, so scans address for i +1, -1 dont have any effect on code.
Note that there is & which means it probably prints the address of i...n my guess is that + 1 has no effect on the output... n regarding scanf - there is no & symbol...so still it will accept a value but not store it in i n my guess is that -1 has no effect on the code.... any comments
As soon as user enters any no. for i compiler will try to access memory location equal to value of i and it will give acess voilation on windows and core dump on Solaris/Linux.