C Programming :: Basic Concepts - Discussion
38 / 90
#include<stdio.h>
void main() {
printf("ABCDEFG \n");
printf(4+"ABCDEFG\n");
printf("ABCDEFG\n"+4);
printf("%c\n", "ABCDEFG" [4]);
printf("%c\n", 4["ABCDEFG"]);
}
#include<stdio.h>
void main() {
printf("ABCDEFG \n");
printf(4+"ABCDEFG\n");
printf("ABCDEFG\n"+4);
printf("%c\n", "ABCDEFG" [4]);
printf("%c\n", 4["ABCDEFG"]);
}
AABCDEFG EFG EFG E E
BCompilation Error
CNo output No Error
DABCDEFG ABCDEFG ABCDEFG ABCDEFG ABCDEFG
Show Explanation
Line 4 and 5 will result to the same output, i.e, it will print the characters from 4th index to (n-1)th index or 6th index. Hence, printing EFG for both the lines.
Line 6 and 7 will also result to the same output, i.e, it will print the character at 4th index position. Hence, printing E for both the lines.
Hence, the output will be ABCDEFG EFG EFG E E.
Asked In ::
Line 3 is simple that it will print ABCDEFG.
Line 4 and 5 will result to the same output, i.e, it will print the characters from 4th index to (n-1)th index or 6th index. Hence, printing EFG for both the lines.
Line 6 and 7 will also result to the same output, i.e, it will print the character at 4th index position. Hence, printing E for both the lines.
Hence, the output will be ABCDEFG EFG EFG E E.
Read Full Answer
Report Error
Please Login First Click Here