find Lengths of strings


Levels of difficulty: / perform operation:


Program

#include <stdio.h>
int main(void)
{
  char str1[] = "AAA";
 
  int count = 0;                 
  while (str1[count] != '\0')    /* Increment count till we reach the string terminating character.*/
    count++;                     
    
  printf("\nThe length of the string \"%s\" is %d characters.", str1, count);

  return 0;
}


Example

The length of the string "AAA" is 3 characters.





Quantitative Aptitude
Reasoning
Programming
Interview