본문 바로가기

C- Programming/변수와 자료형

정수형 변수의 사용 예

#include <stdio.h>


int main()

{

unsigned char age = 97;  //unsigned char 형태로 변수 선언 및 97로 초기화

int max = 2147483647; //int형태로 변수 선언 및 2147483647로 초기화

int max_plus_1 = max + 1; //int 형태로 변수 선언 및 위에 선언한 max값에 +1 하여 초기화

unsigned int super = max + 1; //unsigned int 형태로 변수 선언 및 +1 하여 초기화


printf("age = %d \n max = %d \n", age, max);

printf("max+1 = %d \n", max_plus_1);

printf("super = max+1 = %u\n", super);


return 0;

}


실행결과




'C- Programming > 변수와 자료형' 카테고리의 다른 글

삼각형의 넓이 구하기  (0) 2014.02.21
실수형 변수의 사용 예제  (0) 2014.02.21
자료형의 종류  (0) 2014.02.21
변수 선언의 예  (0) 2014.02.20
변수명& 함수명 작명 규칙  (0) 2014.02.13