Without using Library Function Write a Program to Find Length of String
#include<stdio.h> #include<conio.h> void main() { char str[100]; int length; printf("\nEnter the String : "); gets(str); length = 0; // Initial Length while(str[length]!='\0') length++; printf("\nLength of the String is : %d",length); getch(); }
Explain Me ?
- NULL Character is used to Represent the end of the String
- Initial Length of String is Zero
- Increment variable Length until we get NULL Character .
- Print the Length
Incoming search terms:
- 8051 calculate length of string (1)
- Write a C program that will calculate the length of string without using library functions (1)
- wap to print length and no of words in a user entered string without using library function in c (1)
- wap to find out length of a string (1)
- wap to calculate length of a string using pointer in c language (1)
- Wap length of string without using library function in c (1)