Desc :

무한루프가 돌아가는 이유,,,?

 


Source Code :

#include <stdio.h>
#include <string.h>
#include <ctype.h>

void main()
{
	char buff[] = "boy is man";
	char *pos = buff;

	while (pos)
	{
		if (isalpha(buff[0]) && pos == buff) // 첫 문자가 영문자, 딱 첫번째일때만
		{
			buff[0] &= 0xDF;
			pos++;
		}
		else if (pos == strpbrk(pos, " "))
		{
			*++pos &= 0xDF;
		}
	}
	puts(buff);
}

 


Result :

+ Recent posts