Code:
#include <stdlib.h>
#define UPPER_CASE 1
#define LOWER_CASE 2
int main(void)
{
char c;
int i=0; //flag to check if first character
while(c!='\n')
{
c = getchar();
if (isalpha(c))
{
if ( islower (c) )
{
if(i==0)
{
c = toupper(c);
i++;
}
putchar(c);
}
else
if(isupper(c)) //checking if caps
printf(" %c",c);//if caps,print a space and then the char
}
}
return EXIT_SUCCESS;
}
im just a beginner so completely following the above code might not be good as coding practice might not be so good.
when i run your code, i get an access violation error .i don't know why.
the above code does what you want.
i made the following modifications:
1>a flag variable i :to check if the character being read is the first character.
2>if there is a caps character,then print a space and the character.
hope this is what you want.