336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
개념 :
1. ctype.h 에 포함 되어 있다.
2. space(띄어쓰기) \t(공백) \n(개행) 등을 인자로 받으면 8을 리턴한다.
소스코드 : main.c
#include <stdio.h>
#include <ctype.h>
int main(void)
{
unsigned char szBuffer[] = " Hello\tMozzi \n";
int nSpaceCount = 0;
unsigned char szString[256] = { 0, };
unsigned char *pTemp = szBuffer;
int nStringCount = 0;
int nResult = 0;
puts(pTemp);
while (*pTemp != '\0')
{
nResult = (int)isspace((int)*pTemp);
//공백,\t, \n 8 기타0
if (nResult == 8)
{
nSpaceCount++;
}
else
{
szString[nStringCount] = *pTemp;
nStringCount++;
}
++pTemp;
}
puts(szString);
printf("find space : %d\n", nSpaceCount);
return 0;
}
결과
#c언어, #c언어입문, #프로그램입문, #isspace, #공백검사, #개행 검사
'Programing - C > C Basic grammar ' 카테고리의 다른 글
089 _swab (0) | 2017.07.28 |
---|---|
088 is 함수 정리 (0) | 2017.07.28 |
086 islower isupper (0) | 2017.07.28 |
085 isalnum (0) | 2017.07.28 |
084 isalpha, isdigit (0) | 2017.07.28 |