Problem Statement - First word of sentence (by creating another null terminated string)
Write a program to print the first word of a sentence given by the user by creating another null terminated string.
Program Approach
- A separate character array for collecting the characters of first word is declared.
- In this loop one looks for a matching space(‘ ‘) character. Until it is found character by character copying is done to the target array.
- In the end the null character is placed where the space was found to make it a proper null terminated string.
