Examveda
Examveda

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

A. Memory holding "this" is cleared at line 3

B. Memory holding "this" loses its reference at line 3

C. You cannot assign pointer like in Line 3

D. Output will be This, Program

Answer: Option B


This Question Belongs to C Program >> Pointer

Join The Discussion

Related Questions on Pointer