[C] 소문자는 대문자로 대문자는 소문자로
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int UpperLower(char *temp);
int main()
{
char strtest[10] = {0};
strcpy(strtest, "aBcDeF!@#");
printf("Orinal Str - %s\n\n", strtest);
UpperLower(strtest);
printf("UpperLower - %s\n\n", strtest);
return 0;
}
int UpperLower(char *temp)
{
for( ; *temp != NULL; temp++)
{
if(isalpha(*temp))
{
*temp = *temp ^ 0x20;
}
}
return 0;
}
댓글
댓글 쓰기