C Session # 6 By: Saeed Haratian Fall 2015 Outlines Data Types - - PowerPoint PPT Presentation

c
SMART_READER_LITE
LIVE PREVIEW

C Session # 6 By: Saeed Haratian Fall 2015 Outlines Data Types - - PowerPoint PPT Presentation

Fundamentals of Programming C Session # 6 By: Saeed Haratian Fall 2015 Outlines Data Types Operators Type Conversion Formatted Input / Output Some Useful Functions Structured Programming Data Types unsigned char 8


slide-1
SLIDE 1

Fundamentals of Programming

C

Session # 6

By: Saeed Haratian Fall 2015

slide-2
SLIDE 2

Outlines

 Data Types  Operators  Type Conversion  Formatted Input / Output  Some Useful Functions  Structured Programming

slide-3
SLIDE 3

Data Types

unsigned char 8 bits 0 to 255 signed char 8 bits

  • 127 to 127

char 8 bits unsigned short int 16 bits 0 to 65535 signed short int 16 bits

  • 32767 to 32767

short int 16 bits unsigned long int 32 bits 0 to 4294967295 signed long int 32 bits -2147483647 to 2147483647 long int 32 bits int

slide-4
SLIDE 4

Data Types …

float 32 bits 7 digits 10-38 to 10+38 double 64 bits 15 digits 10-308 to 10+308 long double 80 bits 19 digits 10-4932 to 10+4932

slide-5
SLIDE 5

Operators

( ) ! ~ ++ -- * / % + - << >> <<= >>= == != & ^ | && || ? = += -= *= /= %=

slide-6
SLIDE 6

Type Conversion

 char  short int  int  long int  float  double  long double

slide-7
SLIDE 7

printf : Format Characters

%d %i Decimal Integer %u Unsigned Decimal Integer %o Unsigned Octal %x Unsigned Hexadecimal ( Small Letters ) %X Unsigned Hexadecimal ( Capital Letters ) %w.dd

slide-8
SLIDE 8

printf : Format Characters …

%f %g Decimal Floating Point %e Scientific with 'e' %E Scientific with 'E %w.df %c One Character %s Character String %w.ds

slide-9
SLIDE 9

printf : Escape Sequence

\f New page \n New Line \t Tab \" " \' ' \\ \ \N Octal Constant \xN Hexadecimal Constant

slide-10
SLIDE 10

Useful Functions

 clrscr ( )  gotoxy (x,y)  getch ( )  getche ( )  getchar ( )  putch ( ch )  putchar ( ch )

slide-11
SLIDE 11

Structured Programming

 During the 1960s, it became clear that the indiscriminate use of transfers of control was the root of a great deal of difficulty experienced by software development groups.  The finger of blame was pointed at the goto statement that allows programmers to specify a transfer of control to one of many possible destinations in a program.  The notion of so-called structured programming became almost synonymous with “goto elimination.”  Research had demonstrated that programs could be written without any goto statements.

slide-12
SLIDE 12

Structured Programming …

 The challenge of the era was for programmers to shift their styles to “goto-less programming.”  The results were impressive, as software development groups reported reduced development times, more frequent on-time delivery

  • f systems and more frequent within-budget completion of software

projects.  Programs produced with structured techniques were clearer, easier to debug and modify and more likely to be bug free in the first place.  Research had demonstrated that all programs could be written in terms of only three control structures, namely the sequence structure, the selection structure and the repetition structure.

slide-13
SLIDE 13

Any Questions?