Skip to content

Tag Archives: C-String

int main() {     char p[] = "geeksquiz";     char t;     int i, j;     for(i=0,j=strlen(p); i<j; i++)     {         t = p[i];         p[i] = p[j-i];         p[j-i] = t;… Read More
Output of following program #include <stdio.h> int fun(char *p) {     if (p == NULL || *p == '\0') return 0;     int current = 1, i… Read More
Predict the output of the following program: #include <stdio.h> int main() {     char str[] = "%d %c", arr[] = "GeeksQuiz";     printf(str, 0[arr], 2[arr + 3]);… Read More
#include <stdio.h>     void my_toUpper(char* str, int index) {     *(str + index) &= ~32; }     int main() {     char* arr = "geeksquiz";     my_toUpper(arr, 0);… Read More
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

Start Your Coding Journey Now!