Strings are defined as an array of characters. The difference between a character array and a string is the string is terminated with a special… Read More »
strcpy() is a standard library function in C/C++ and is used to copy one string to another. In C it is present in string.h header… Read More »
strcmp() is a built-in library function and is declared in <string.h> header file. This function takes two strings as arguments and compare these two strings… Read More »
Below is syntax of Scanf. It requires two arguments: scanf(“Format Specifier”, Variable Address); Format Specifier: Type of value to expect while input Variable Address: &variable… Read More »
Output of following C program? Assume that all necessary header files are included (A) GeeksQuiz (B) Geeks (C) Geeks Quiz (D) Quiz Answer: (A) Explanation:… Read More »
Write a function mysubstr() in C that doesn’t use any string function, doesn’t use any loop and prints substring of a string.
Write a C function print(n) that takes a long int number n as argument, and prints it on console.
Predict the output of following program, assume that a character takes 1 byte and pointer takes 4 bytes. (A) sizeof(str1) = 10, sizeof(str2) = 10… Read More »
Assume that a character takes 1 byte. Output of following program? (A) 9 (B) 10 (C) 20 (D) Garbage Value Answer: (C) Explanation: Note that… Read More »
Find the length of a string without using any loops and string.h in C. Your program is supposed to behave in following way:
Output? (A) ziuqskeeg (B) Nothing is printed on the screen (C) geeksquiz (D) gggggggg Answer: (B) Explanation: The string termination character ‘\0’ is assigned to… Read More »
Output of following program (A) gekskeg (B) geeksskeeg (C) geeks (D) Garbage Values Answer: (A) Explanation: The function mainly replaces more than once consecutive occurrences… Read More »
Predict the output of the following program: (A) G Q (B) 71 81 (C) 71 Q (D) Compile-time error Answer: (C) Explanation: The statement printf(str,… Read More »
(A) GeeksQuiz (B) geeksquiz (C) Compiler dependent Answer: (C) Explanation: The memory for the string arr is allocated in the read/write only area of data… Read More »
Consider the following C program segment: The output of the program is? (GATE CS 2004) (A) gnirts (B) gnirt (C) string (D) no output is… Read More »