- #1
ccky
- 15
- 0
The lab requires me to displace that:
Enter a string:This is a string
One word per line is:
This
is
a
string
How can I replace the ' 'with Enter.
Thanks.
Enter a string:This is a string
One word per line is:
This
is
a
string
How can I replace the ' 'with Enter.
Code:
#include <stdio.h>
#define STRSIZE 81
void dispStr(char message[STRSIZE])
{
int i;
printf("\nOne word per line is :\n");
while (message[i]!=' ')
{
}
}
int main()
{
char message[STRSIZE];
printf("Enter a string: ");
gets(message);
dispStr(message);
return 0;
}
Thanks.