Tuesday, March 11, 2025

C Language Constants and Variables

 

                                                    Constant & Variables                                                                        


Constant
                     

    Numeric Constants                                                                                        Non-Numeric

Integers (int)               float                                                      character (char)              String

0 1 2 -2 4 5                   0.0 0.1 1.0                                         within Single quote      Within Double quote

256, -786, 654 etc      -1.0 0.0001                                           Single character.           More than one                                            2.34   2.1E+12   2.1E-12                                                                        character.

                                     -2.1E+12                                           ' ' 'a'  'A'    '9' '+'             "     "    "Khammam"

                                                                                                    't'  '#'                     "Rama Rao" "10-5-46"                                                                                                                                                                                                                                                                                                               "a+b"     "5+9"


    Variables

Variables : Name of the constants. 

Rules

-A Variables start with any alphabet

-followed by any alphabet or numerics

-Not allowed the special sysmbols, except underscore( _ )

-Do not use keyword as a Variable.

-Maximum size in MSDOS, 36 charactrs.  unlimit in UNIX OS.

-Case differnt.  ex. AB    ab     Ab    aB

ex.     a  b  c  d    abcd    r root     r1  root1     r2   root2     Address

area    volume    si ci hno street  city    pincode     sname         book_name

area_of_circle  x      y       z





C Programming Structure

 

                               'C'  Program Structure 


/* Documentation Section  */

#Global Linkage Section

#Global Definition Section         

Global Variable Declaration Section;

main( ) -------------------------------> Main Program Function

{          -------------------------------> Main Program Function Begin

        Type Declaration Section;   

        Executable Statement 1; 

        Executable Statement 2;

        ---------------------------             

        ---------------------------    

        Executable Statement n; 

        sub_Programfun(arg);

}         -------------------------------> Main Program Function End


sub_Programfun(Type arg) -------------------------------> Sub Program Function

                                        -------------------------------> Sub Program Function Begin

        Type Declaration Section;   

        Executable Statement 1;

        Executable Statement 2;

        ---------------------------

        ---------------------------

        Executable Statement n; 

        return;

}                                          -------------------------------> Sub Program Function End

Monday, March 10, 2025

C Language Introduction

 Software

Programs --->Set of Instructions

Computer Languages

High Level Language             Middle Level Language                   Low Level Language

Basic, C, C++, Cobol,               Translators                                      Machine Language(LLL)

Python, Prolog, Fortran                Interpreter      Compiler                  Assembler

Pascal, Java, Lisp etc                                                                              C MSA Fourth

                                                 

Interpreter Languages     ------->  Basic C Lisp   Java

Compiler Languages      --------> C C++ Cobol     Java         Fortran Pascal       Prolog Python Java



C Family Languages :  C   C++  VC++    C#    VC++.Net   C#.Net     Java

  


     C Language.


- Less Key Words (32)

- Function Supporting

- Speed Processing

- Program Portability


            History of C


1967    BCPL : Basic Combined Programming Language

            'B'            BW Kernighan &  DM Ritchie

 MULTICS OS  Ken Thomson

     |      |    1968

      B--|        --------Unix OS              1970

                               C Language 

                        UNIX   --------- 90%  C Program      + 10 Unix Code


Character Set of C

Alpha Bets       A    -    Z

                               a     -    z

Numeric            0     -   9


Special Symbols

  ~ ! @ # $ % ^ & * ( ) - _ + = {  } [ ]  \ | ; : ' " , . < > / ?  Blank


Key Words

auto         double            int                    struct

break        else          long            switch

case          enum        register              typedef

char          extern      return            union

const        float          short            unsigned

continue  for            signed            void

default      goto          sizeof            volatile

do              if                     static                 while