Example if user enters:
My name is James.
Using scanf, I have to print the full line, i.e. My name is James.
, then I have to get t
#include "stdio.h"
#include "conio.h"
void main()
{
char str[20];
int i;
clrscr();
printf("Enter your string");
scanf("%[^\t\n]s",str); --scanf to accept multi-word string
i = strlen(str); -- variable i to store length of entered string
printf("%s %d",str,i); -- display the entered string and length of string
getch();
}
output :
enter your string : My name is james
display output : My name is james 16