Home / C Programming / Strings :: Discussion

Discussion :: Strings

  1. What will be the output of the program ?

     #include
     #include  
    
      int main()
      {    
          printf("%c\n", "abcdefgh"[4]);     
          return 0;
      }
    

  2. A.

    Error

    B.

    d

    C.

    e

    D.

    abcdefgh

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    printf("%c\n", "abcdefgh"[4]); It prints the 5 character of the string "abcdefgh".

    Hence the output is 'e'.


Be The First To Comment