所以,我想要做的是创建一个函数,将大写字母切换为小写字母,反之亦然。小写字母<-->大写字母不能按计划工作
这里是我的工作:
#include <stdio.h>
#include <stdlib.h>
int caplowswitch(char string[], char switched[]);
int main(){
char name[] = "whyisthisnotworking";
char flipped[] = "";
caplowswitch(name, flipped);
return 0;
}
int caplowswitch(char word[], char switched[]){
char *ptrword = word;
unsigned short int counter = 0;
printf("Your text input is: %s \n", word);
while(*ptrword != NULL){
switched[counter] = (*ptrword^0x20);
counter++;
ptrword++;
}
printf("Your flipped text is: %s \n", switched);
return 1;
}
在学习的过程。谢谢你的时间。
而这不起作用...怎么样?我们应该猜测问题是什么?我们在这里帮助,而不是你的调试器。 –
你放入“*切换*”的字符在哪里结束? (提示:不在数组中切换/翻转,因为这只是一个字符长。) –