fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main ()
  5. {
  6.  
  7. char s1 [20] = {"Some String"}; /* test string */
  8. int retVal; /* holds return value */
  9.  
  10. printf ("The string at the start of array s1 has a size of %d \n", strlen (s1));
  11. printf ("The empty string has a size of %d \n", strlen (""));
  12. printf ("String with just a single space character, size is %d \n", strlen (" "));
  13. printf ("Two special characters in a string, size is %d \n", strlen ("\007\n"));
  14.  
  15. retVal = strlen (s1) + 10; /* 11 + 10 */
  16.  
  17.  
  18. return (0);
  19. }
Success #stdin #stdout 0s 5312KB
stdin
Standard input is empty
stdout
The string at the start of array s1 has a size of 11 
The empty string has a size of 0 
String with just a single space character, size is 1 
Two special characters in a string, size is 2