+ 1

What will be the output of the following in c: printf( 6 + "hello world" /n)

7th Jan 2022, 4:13 PM
Parthib Das
Parthib Das - avatar
2 Réponses
+ 6
In c, string is not present and it can be considered as char pointer or array of char so, hello world is char* argument to printf. So we can do arithmetic operations + on pointer which moved pointer from zero index to sixth index... hence world would be output here.
7th Jan 2022, 5:04 PM
GURURAJ KL
GURURAJ KL - avatar
+ 5
printf( 6 + "hello world\n" ); Outputs "world" But as it is written in your question, it's not gonna work. If you want to understand this, try modifying the number from 6 to another number and notice the output.
7th Jan 2022, 4:52 PM
Ipang