Wipro interview question

C Program to Find the Length of a String without using the Built-in Function

Interview Answer

Anonymous

5 Jul 2017

#include void main() { char string[50]; int i, length = 0; printf("Enter a string \n"); gets(string); for (i = 0; string[i] != '\0'; i++) { length++; } printf("The length of a string is the number of characters in it \n"); printf("So, the length of %s = %d\n", string, length); }