the fundamental data type n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
The fundamental data type PowerPoint Presentation
Download Presentation
The fundamental data type

Loading in 2 Seconds...

play fullscreen
1 / 20

The fundamental data type - PowerPoint PPT Presentation


  • 68 Views
  • Uploaded on

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 참고 ).

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

PowerPoint Slideshow about 'The fundamental data type' - ossie


An Image/Link below is provided (as is) to download presentation

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
declarations expressions and assignments
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 참고)

expressions
Expressions
  • Meaningful combinations of constants, variables, operators, and function calls
  • a+b

5.0*x – tan(9.0/x)

  • Page 689 참고
assignments
Assignments
  • variable = expr ;
  • Page 689 참고
  • 숙제 :::

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

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

the fundamental data types
The fundamental data types
  • Declaration ::=

type identifier {, identifier}0+ ;

long form
Long form
  • fundamental types
  • array, pointer, structure ::: derived types
widely used form
Widely used form
  • ‘int’ can be omitted
3 3 characters and the data type char
3.3 Characters and the Data Type char
  • getchar(), putchar()
  • 8bits (28 =256)
  • 대문자, 소문자, 숫자, 구두점, 특수문자
  • White space characters는 포함
  • 제어문자는 제외
  • ASCII, EBCDIC
slide12
출력
  • printf(“%c”, ‘\a’) ;  putchar(‘\a’)
  • printf(“%\”abc\””) ;

“abc”

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

 ‘abc’

slide13
출력 예
  • 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’
integer
Integer
  • 32bits : -231, -231+1 … -1, 0, 1, …

… 231-1

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

… 215-1

  • Nmin_int ≤ i ≤ Nmax_int
short long unsigned
Short, long, unsigned
  • short  16bits
  • long  32bits
  • unsigned 

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

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

= 65535

  •  16bits 기계  32000(short), 33000(long)
the floating types
The floating types
  • Float, double, long double
floating point
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으로 구현
the use of typedef
The use of typedef
  • typedef char uppercase

typedef int INCHES, FEET;

typedef unsigned long size_t;

  • uppercase u;

INCHES length, width;

the sizeof operator
The sizeof Operator
  • 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)