how to find and print only the first word from each line of a file using C programming
how to find and print only the first word from each line of a file using C programming
- Open the file
- Read a line of text
- Find the space
- Print out everything before the space
- Repeat steps 2-4 until the end of file is reached
- close the file
how to do your own homework?
how to print everything before space??
i have done rest
Code:char *letter = sentence; while(*letter && *letter != ' ') { printf("%c",*letter); letter++; }