Im having a bit of trouble converting a string to lower case then to upper case.
Code:
#include <stdio.h>
#include <string.h>
int main(void)
{
char buf[80], *ptr, *string;
while (1)
{
puts("Enter a line of text, a blank to exit.");
fgets(buf, sizeof buf, stdin);
if ((ptr=strchr(buf,'\n'))!=NULL)
*ptr='\0';
if (strlen(buf)==0)
break;
string = buf;
tolower(string);
puts(buf);
toupper(string);
puts(buf);
}
return 0;
}
The only error is
upper.c:32:2: warning: no newline at end of file
Line 32 is the last brace.
[edit]
If its any help I am using gcc
[/edit]