1 / 20

# The fundamental data type - PowerPoint PPT Presentation

The fundamental data type. 제 4 주 강의. Declarations, Expressions, and Assignments. Declaring the type of a variable  set an appropriate amount of space in memory by a compiler  deciding appropriate operations  checking invalid operations and operands (686page 참고 ).

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about ' The fundamental data type ' - ossie

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### The fundamental data type

제4주 강의

• Declaring the type of a variable

 set an appropriate amount of space in memory by a compiler

 deciding appropriate operations

 checking invalid operations and operands

(686page 참고)

• Meaningful combinations of constants, variables, operators, and function calls

• a+b

5.0*x – tan(9.0/x)

• Page 689 참고

• variable = expr ;

• Page 689 참고

• 숙제 :::

a=b=c+d=e  이것이 정상적인 assignment statement임을 문법을

참고로 증명하라!!! 적용된 문법을 보일 것

• Declaration ::=

type identifier {, identifier}0+ ;

• fundamental types

• array, pointer, structure ::: derived types

• ‘int’ can be omitted

• getchar(), putchar()

• 8bits (28 =256)

• 대문자, 소문자, 숫자, 구두점, 특수문자

• White space characters는 포함

• 제어문자는 제외

• ASCII, EBCDIC

• printf(“%c”, ‘\a’) ;  putchar(‘\a’)

• printf(“%\”abc\””) ;

“abc”

• printf(“%cabc%c”, ‘\’’,’\’’) ;

 ‘abc’

• int c; int i;

• for (i=‘a’; i<=‘z’;++i)

printf(“%c”,i); /* abc …z */

• for (c=65; c<=90;++c)

printf(“%c”,c); /* ABC … Z */

• for (c=‘0’; c<=‘9’;++c)

printf(“%d”,c); /* 48 49 … 57 */

• 01100001(2) == 97 == ‘a’

• 32bits : -231, -231+1 … -1, 0, 1, …

… 231-1

• 16bits : -215, -215+1 … -1, 0, 1, …

… 215-1

• Nmin_int ≤ i ≤ Nmax_int

• short  16bits

• long  32bits

• unsigned 

32bits 기계: Nmax_unsigned = 232 -1 (일부시스템)

16bits 기계: Nmax_unsigned = 216 –1 (일부시스템)

= 65535

•  16bits 기계  32000(short), 33000(long)

• Float, double, long double

Floating point 값의 표현

• Precision, range

• float 

0.d1d2…d6 x 10n (-38 ≤ n≤ 38)

• double 

0.d1d2…d15 x 10n (-308 ≤ n≤ 308)

• 123.45123451234512345 

0.123451234512345 x 10+3 (유효숫자 15)

• long double  long으로 구현

• typedef char uppercase

typedef int INCHES, FEET;

typedef unsigned long size_t;

• uppercase u;

INCHES length, width;

• sizeof(object)

• sizeof(char)  1

• sizeof(char) ≤ sizeof(short) ≤ sizeof(int) ≤ sizeof(long)

• sizeof(signed) = sizeof(unsigned) = sizeof(int)

• sizeof(float) ≤ sizeof(double) ≤ sizeof(long double)