#include <stdio.h> void my_toUpper(char* str, int index) { *(str + index) &= ~32; } int main() { char* arr = "geeksquiz"; my_toUpper(arr, 0);… Read More
Tag Archives: C-String-Question
Consider the following C program segment: char p[20]; char *s = "string"; int length = strlen(s); int i; for (i = 0; i < length;… Read More
Output? int main() { char a[2][3][3] = {'g','e','e','k','s','q','u','i','z'}; printf("%s ", **a); return 0; } (A) Compiler Error (B) geeksquiz followed by garbage characters (C) geeksquiz… Read More
In below program, what would you put in place of “?” to print “Quiz”? #include <stdio.h> int main() { char arr[] = "GeeksQuiz"; printf("%s", ?); … Read More
#include<stdio.h> int main() { char str[] = "GeeksQuiz"; printf("%s %s %s\n", &str[5], &5[str], str+5); printf("%c %c %c\n", *(str+6), str[6], 6[str]); return 0; } (A) Runtime… Read More
What does the following fragment of C-program print? char c[] = "GATE2011"; char *p =c; printf("%s", p + p[3] - p[1]) ; (A) GATE2011 (B)… Read More
Predict the output? #include <stdio.h> int fun(char *str1) { char *str2 = str1; while(*++str1); return (str1-str2); } int main() { char *str = "GeeksQuiz";… Read More
What is the output of following program? #include<stdio.h> void swap(char *str1, char *str2) { char *temp = str1; str1 = str2; str2 = temp; } … Read More
What is the output of following program? # include <stdio.h> int main() { char str1[] = "GeeksQuiz"; char str2[] = {'G', 'e', 'e', 'k',… Read More
Consider the following code. The function myStrcat concatenates two strings. It appends all characters of b to end of a. So the expected output is… Read More