一道c的题目,请高手指教
将p所指字符串中每个单词的最后一个字母该成大写eg:I am a student to take the examination.->
I aM A studenT tO takE thE exanination.
#include<conio.h>
#include<ctype.h>
#include<stdio.h>
void fun(char *p)
{
int k=0;
for( ;*p; p++)
if(k)
{
if(*p==' ')
{k=0;
*(p-1)=toupper(*(p-1));
}
}
else
k=1;
}
main()
{
char chrstr[64];
int d;
clrscr();
printf("\nPlease enter an English sentence within 63 letters:");
gets(chrstr);
d=strlen(chrstr);
chrstr[d]='';
chrstr[d+1]=0;
printf("\n\nBefore changing:\n %s",chrstr);
fun(chrstr);
printf("\nAfter changing:\n %s",chrstr);
} 有问题,应该怎么该??