Vidyalelo
C Programming · Q156

Pointer

Programming · C Programming · question 156

Q156

Comment on the output of the following C code. #include int main() char *str = "This" //Line 1 char *ptr = "Program "; //Line 2 str = ptr; //Line 3 printf("%s, %s ", str, ptr); //Line 4

A.
Memory holding "this" is cleared at line 3
B.
Memory holding "this" loses its reference at line 3
Answer
C.
You cannot assign pointer like in Line 3
D.
Output will be This, Program

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board