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 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
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
Operators ( ) ! ~ ++ -- * / % + - << >> <<= >>= == != & ^ | && || ? = += -= *= /= %=
Type Conversion char short int int long int float double long double
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
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
printf : Escape Sequence \f New page \n New Line \t Tab \" " \' ' \\ \ \N Octal Constant \xN Hexadecimal Constant
Useful Functions clrscr ( ) gotoxy (x,y) getch ( ) getche ( ) getchar ( ) putch ( ch ) putchar ( ch )
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.
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 of 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.
Any Questions?
Recommend
More recommend