Home / C Programming / Strings :: Discussion

Discussion :: Strings

  1. What will be the output of the program ?

     #include
     #include
    
      int main()
      {
         printf("%d\n", strlen("123456"));                 
         return 0; 
      } 

     

  2. A.

    6

    B.

    12

    C.

    7

    D.

    2

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    The function strlen returns the number of characters in the given string.

    Therefore, strlen("123456") returns 6.

    Hence the output of the program is "6".


Be The First To Comment