Home / C Programming / Strings :: Discussion

Discussion :: Strings

  1. Will the program compile successfully?

    #include 
     int main() 
     {    
         char a[] = "Fresher";  
         char *p = "GATE";  
         a = "GATE";  
         p = "Fresher";  
         printf("%s %s\n", a, p);  
         return 0;
     } 
    

     

  2. A.

    Yes

    B.

    No

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    Because we can assign a new string to a pointer but not to an array a.


Be The First To Comment