C
Q. What will be the output of the following C code?
#include <stdio.h> int main() { char str1[] = { 'H', 'e', 'l', 'l', 'o' }; char str2[] = "Hello"; printf("%ld,%ld", sizeof(str1), sizeof(str2)); return 0; }
str1 is initialized with the characters and there are only 5 characters. Thus, the length of the str is 5. While, str2 is initialized with the string "Hello", when we initialized the string in this way - a null ('\0') character is inserted after the string. Thus, the length of str2 is 6.
You must be Logged in to update hint/solution
Be the first to start discuss.
Q. Find a correct C Keyword below.
Q. What type of array is generally generated in Command-line argument?
Q. What is the output of C Program with String Pointer?
Q. Which one is a special function in C system to tell the computer where the program start
Q. Which of the following is not a storage class specifier in C?
Q. By default, any real number in 'C' is treated as
Q. In which year was C language developed?
Q. Types of Real numbers in C are.?
Discusssion
Login to discuss.