What will be the output of the following statement ? printf( 3 + "goodbye");
Answers
Answered by
0
Explanation:
what will be the output of the following statement int a=10; printf(%d i'',a=10)
Answered by
0
Answer:
The output of the following statement ? printf( 3 + "goodbye") is "dbye"
Explanation:
- "goodbye" is a character array.
- If we assume base address of the character array "goodbye" as 1024.
- The starting address points to the character 'g'.
- 3 + "goodbye" or "goodbye" + 3
- 3 + "goodbye" will be (base address + 3 which is 1027).(size of character is 1 byte.)
- Now the starting address is 1027 which points the character 'd'.
- printf will print the given message from the starting address to the end.
- Here, starting address has changed to 1027.
- So, it will print "dbye"
- goodbye+3 printf
#include<stdio.h>
int main()
{
printf(3 + "goodbye");
return 0;
}
Output
dbye
- "Goodboy" + 4
- Now the starting address of the character array "goodbye" is 1024+4 = 1028.
- 1028 is the address of the character 'b'.
- So, it will print bye
#include<stdio.h>
int main()
{
printf("goodbye" + 4);
return 0;
}
Output
bye
Reference link
- https://brainly.in/question/43427935
- https://brainly.in/question/51548290
Attachments:
Similar questions