[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;
}

댓글

이 블로그의 인기 게시물

[NSIS] 32비트와 64비트 모듈 등록하는 법. (regsvr32)

[Visual Studio] Windows 7 에서 Visual Studio 6.0 디버그 시 프로세스 좀비되는 증상 해결 방법