C

                                                BASIC CONCEPT OF C

History of C:-

Dennis Ritchie  developed "C" language  in 1970 at AT&T Bell laboratories. initially it was designed for programming  in the operating system called UNIX.After advent of "C"  whole UNIX operating system and C compiler also rewritten  in c language. if you open source code of Linux then you also get more than 80% code written in C language.


Why C:- 

we know that when we write a code for any program. when we executing  data is store in register . for all microcontrolers  and microprocessors they have different sets of registers for storing data. so assembly or other language has change their instruction that is very difficult  to remember for us. i.e we use c language for programming purpose and it also user friendly programming because for other platform we have to less change in programming. in c language only 32 keywords.



Structure of c programs:-

//comments

preprocessor directives

global variable

int main(void)

{

local variables

statements

.......................

...................

return 0;

func(0

.................

......................


}



Compilation and execution of c programs:-

  •            Preprocessor    
  •                               compiler (translater)           
  • Assmbler
  •        linker          
  These are the four step of compilation and execaution of our c program.....
  1. In first stage our source code goes to preprocessor here we get expended code extension of (.i)
  2. in 2nd stage our expended  code convert in assembly code  extension of(.s)
  3. in 3rd stage our assembly code convert in object code extension of (.o)
  4. in final stage linker convert it into executable code extension of (.exe)or (.out) depend on platform.

Elements of c:-

Character sets:-

                   A,B,C,...................,Z.    ASCII (65-90) 

                    a,b,c,....................,z.     ASCII (97-122) 

                   0,1,2,3....................9.     ASCII (48-57) 

               ;                          ASCII (59)  


ESCAPE SEQUENCES:-

\b  .............................................Backspace

\a ..............................................bell (alert)

\r ...............................................carriage return

\n ..............................................new line

\0 ..............................................null 

\t ...............................................horizontal tab

\\ ...............................................backslash


Formate specifiers:-


Keywords:-

auto                  break              case                  char                 const                       continue

default              do                  double               float                int                           if                             else                   while              volatile             void                unsigned                 union                     typeof                switch            struct                static               size of                    signed                   short                  return              register            long                 goto                       for 

enum                extern                   



Range of datatypes:-

Basic data types                                           Size                                              Range

char                                                               1                                              -128 to127(signed)

char                                                               1                                              0 to 255(unsigned)

int                                                                  2                                              -32768 to 32767(signed)

int                                                                  2                                               0 to 65535(unsigned)

int(short)                                                       1                                                -128 to 127(signed)

int(short)                                                       1                                              0 to 255(unsigned)

int(long)                                                        4                                -214783648 to2147483647(signed)

int(long)                                                        4                                   0 to 4294967295(unsigned)

float                                                               4                                             3.4E-38 to 3.4E+308

double                                                           8                                             1.7E-308 to 1.7E+308

double long                                                   10                                          3.4E-4932 to 1.1E+4932


Constant:-

  1. numeric constant
  2. character constnt
  3. string constant
  • numeric costant
  1. integer constant
  2. real constant

  • integer constant

octal (base 8  0----------------7)

decimal (base 10   0----------9)

hexadecimal(16  0-------------f)


                 MINI PROJECT


STUDENT DATA BASE




No comments: