Saturday, June 17, 2023

C language - Introduction

 

                          C language

INTRODUCTION:

                           C Language author (Dennis Ritchie)

  • C is Developed for operating   system- os(windows,linux,unix)
  • C author is Dennis Ritchie - 1970
  • C language    published on 1972
  • C language developed from    B Language ,BCPL(Basic Computer Programming language).
  •  ANSI -   American National standard Institute  -1983
  • in advanced version -1989
  • first copy is Released on 1990
  • c- Structure (OR) procedure oriented language

    c-  case sensitive

    c- top down approach

 

 

Features’ Of  C :

      *  Modularity
 *Code Reusability
 * Limited Number of Keyword
 * Portability
 * Ability to Extend Itself

 

Characteristics of c:

Ø Small Size (memory)

Ø Structured Language

Ø It has high level construct

Ø It can handle low level activities

Ø It can be compiled on a variety of computer


# header file

main()

{                          

      }

USES OF C:

v OPERATING SYSTEM

v Editors (Note pad, word pad, ms office)

v File utilities

v Compile

v Performance Enhancer

                                                  


(C,C++)-           -->    COMPILER LANGUAGE


(JAVA , PYTHON)          ->     Interpreter language

 

 

Machine Language             Binary (or) Bitwise  0(or)1

 

 

ASCII VALUE:

A- 
65        a-97

B-   66         b -98

C-   67          c-99

D-   68          d-100                                                               8 bit = 1 byte

Z-90              z-120  

    C Compilation Model


   C Keywords 

                    






1.    AUTO

2.       IF

3.       DOUBLE

4.       STRUCT

5.       DO

6.       LONG

7.       SIGNED

8.       EXTERN

9.       TYPE DEF

10.   RETURN

11.   CHAR

12.   REGISTER

13.   SHORT

14.   SIZE OF

15.   BREAK

16.   CONTINUE

17.   VOLATDE

18.   GO TO

19.   STATIC

20.   WHILE

21.   FLOAT

22.   UNION

23.   ELSE

24.   SWITCH

25.   CASE

26.   ENUM

27.   CONST

28.   VOID

29.   FOR

30.   UNSIGNED


31.   DEFALUT

32.   INT

 


C Data type

Data type        

keyword

Byte value

 Format string

range

character          

char                       

1

%c

-127to127

integer                

int                          

2

%d

-32,767to32,767

float                   

float                        

4

%f

-3.4E-38 to 3.4E+38

double              

double              

8

%lf

-1.7E-38 to 1.7E+38

                                   


VARIABLE:

Permanent Value Storage

SYNTAX   

       Datatype variable name= value;

 int a=10;

float b= 1.2;

char c = ‘A’;

int Hello_world = 10;

ESCAPE SEQUENCE

 

\n – new line (or )  next line

\t-     tab space

 

COMMENTS

*       single line comment   //

*       multi line comment   /*     */

 

Header file 

#include<stdio .h>



  stdio.h     -         standard input output                                                   

input(scanf)                                      output (print f)

 (value storage)                                   (value printing)

 

#include <conio.h>



  console input output

  getch                                      clrscr

(user screen view)                   (don’t repeat old output)

main () (function)

{

         }

 

 SAMPLE  PROGRAM

 #include <stdio.h>

#include <conio.h>

main()

{

  clrscr();

printf(“hi  hello\n”);

printf(“welcome to programtechie”);

getch ();


}

output:
  hi hello
  welcome to programtechie
 

                                            RUN TIME PROGRAM

#include <stdio.h>

#include <conio.h>

main()

{

int a;

clrscr();

printf(“enter a value”);

scanf(“%d,” &a);

printf(“a value=%d”,a);

getch();


}

output:

 enter a value 5

   a value=5                     

                                     

0 comments:

Post a Comment