short 연습1
#include <stdio.h>
int main()
{
unsigned char cNum;
unsigned short sNum;
cNum=-1;
printf("%d\n", cNum);
sNum=-1;
printf("%d\n", sNum);
return 0;
}
결과
int 연습1
#include <stdio.h>
int main()
{
//unsigned char cNum;
//unsigned short sNum;
//unsigned int iNum;
char cNum;
short sNum;
int iNum;
cNum=-1;
sNum=-1;
iNum=-1;
printf("cNum[%d], sNum[%d], iNum[%d]\n", cNum, sNum, iNum);
sNum=cNum;
printf("cNum[%d], sNum[%d], iNum[%d]\n", cNum, sNum, iNum);
return 0;
}
결과
*unsigned char cNum; ->변수선언
unsigned -> 양수로 표현하라는 뜻
cNum -> 변수(명)