Which of the following statement is correct?
Which of the following statements are correct ?
1:A string is a collection of characters terminated by ' '.
2:The format specifier %s is used to print a string.
3:The length of the string can be obtained by strlen().
4:The pointer CANNOT work on string.
Which of the following statements are correct about the below declarations?
char *p = "Sanjay";
char a[] = "Sanjay";
1: There is no difference in the declarations and both serve the same purpose.
2: p is a non-const pointer pointing to a non-const string, whereas a is a const pointer pointing
to a non-const pointer.
3: The pointer p can be modified to point to another string, whereas the individual characters within
array a can be changed.
4: In both cases the ' ' will be added at the end of the string "Sanjay".
Which of the following statements are correct about the program below?
#include<stdio.h> int main() { char str[20], *s; printf("Enter a string\n"); scanf("%s", str); s=str; while(*s != '\0') { if(*s >= 97 && *s <= 122) *s = *s-32; s++; } printf("%s",str); 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<stdio.h> int main() { printf("%u %s\n", &"Hello1", &"Hello2"); return 0; }