Warning: implode(): Invalid arguments passed in /www/wwwroot/jobquiz.info/mdiscuss.php on line 336 What will be the output of the program ? #include<stdio.h> int main() { char str[25] = "IndiaBIX"; printf("%s\n", &str+2); return 0; } ?->(Show Answer!)
1. What will be the output of the program ? #include<stdio.h> int main() { char str[25] = "IndiaBIX"; printf("%s\n", &str+2); return 0; }
Ask Your Doubts Here
Comments
By: guest on 01 Jun 2017 06.02 pm
Step 1: char str[25] = "IndiaBIX"; The variable str is declared as an array of characteres and initialized with a string "IndiaBIX". Step 2: printf("%s\n", &str+2); => In the printf statement %s is string format specifier tells the compiler to print the string in the memory of &str+2 => &str is a location of string "IndiaBIX". Therefore &str+2 is another memory location. Hence it prints the Garbage value.