Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Home
»
C Programming
»
Strings
What will be the output of the program? #include
#include
int main() { printf("%c\n", "abcdefgh"[4]); return 0; }
Error
d
e
abcdefgh
Correct Answer:
e
Explanation:
printf("%c\n", "abcdefgh"[4]);
It prints the 5 character of the string "abcdefgh".
Hence the output is 'e'.
← Previous Question
Next Question→
More Questions from
Strings
What will be the output of the program? #include
int main() { char str[25] = "CuriousTab"; printf("%s\n", &str+2); return 0; }
What will be the output of the program (Turbo C in 16 bit platform DOS)? #include
#include
int main() { char *str1 = "India"; char *str2 = "CURIOUSTAB"; char *str3; str3 = strcat(str1, str2); printf("%s %s\n", str3, str1); return 0; }
What will be the output of the program? #include
int main() { int i; char a[] = "\0"; if(printf("%s", a)) printf("The string is not empty\n"); else printf("The string is empty\n"); return 0; }
What will be the output of the following program in 16 bit platform assuming that 1022 is memory address of the string "Hello1" (in Turbo C under DOS)? #include
int main() { printf("%u %s\n", &"Hello1", &"Hello2"); return 0; }
If the size of pointer is 4 bytes then What will be the output of the program? #include
int main() { char *str[] = {"Frogs", "Do", "Not", "Die", "They", "Croak!"}; printf("%d, %d", sizeof(str), strlen(str[0])); return 0; }
What will be the output of the program? #include
int main() { char str[] = "Nagpur"; str[0]='K'; printf("%s, ", str); str = "Kanpur"; printf("%s", str+1); return 0; }
What will be the output of the program? #include
int main() { char p[] = "%d\n"; p[1] = 'c'; printf(p, 65); return 0; }
What will be the output of the program? #include
int main() { printf(5+"Good Morning\n"); return 0; }
What will be the output of the program? #include
int main() { char str1[] = "Hello"; char str2[10]; char *t, *s; s = str1; t = str2; while(*t=*s) *t++ = *s++; printf("%s\n", str2); return 0; }
What will be the output of the program? #include
int main() { char str = "CuriousTab"; printf("%s\n", str); return 0; }
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment
Join Discussion
Discussion & Comments