Getting string from gets() and find string length ( Chapter 1 Program 7 )
Also visit our YouTube Channel Tech Eos VISIT CHANNEL /* 7. Write a program to enter text with gets() and display it using printf() statement also find the length of the text */ #include<stdio.h> #include<conio.h> void main() { char string[99]; int length = 0; clrscr(); printf("Enter an string : "); gets(string); printf("\n\nYour string is %s" , string ); while( string[length] != '\0' ) { length++; } printf("\n\nYour string length is %d ", length ); getch(); }