Saturday, 11 March 2023

WHAT IS C PROGRAMMING LANGUAGE ?

 INTRODUCTION

WHAT IS PROGRAM ?



  • A PROGRAM IS THE SET OF INSTRUCTIONS GIVEN TO THE COMPUTER.
  • THE INSTRUCTIONS GIVEN TO THE COMPUTER BY THE PROGRAMMING LANGUAGES LIKE,                                                                                             ⇒ C , C++, C# , JAVA , PYTHON  etc..,   
  • ALL PROGRAMMING LANGUAGES HAVING SET OF RULES CALLED SYNTAX.
  • SYNTAX IS A BASE OF EVERY PROGRAMMING LANGUAGE,EVERY LANGUAGE AS ITS OWN SYNTAX . IT IS A PRE-DEFINED RULES AND PROCEDURES WHICH USER MUST BE FOLLOWED WHILE WRITING ANY INSTRUCTION IN A PROGRAMMING LANGUAGE.

C LANGUAGE

     C LANGUAGE IS A MOST POPULAR PROGRAMMING LANGUAGE BECAUSE IT IS A STRUCTURE , HIGH LEVEL , MACHINE INDEPENDENT LANGUAGE. 

     ⇛ ALGOL WAS THE FIRST PROGRAMMING LANGUAGE TO USE A BLOCK STRUCTURE, IT WAS DEVELOPED IN  EARLY  1960's ,

     ⇛ IN 1967, MARTIN RICHARD DEVELOPED A LANGUAGE CALLED BCPL(BASIC COMPUTER PROGRAMMING LANGUAGE). 

     ⇛ IN 1970, KEN THOMPSAN CREATED A LANGUAGE USING MANY FEATURES OF BCPL AND IT IS CALLED AS B LANGUAGE.IN 1970's C WAS EVOLVED FROM ALGOL,BCPL AND B , IT WAS DEVELOPED BY DENNIS RITCHIE AT BELL LABOURATORIES.

HOW TO GET OUTPUT FROM THE PROGRAM ?

         WHENEVER WE WRITE THE PROGRAM FIRST WE HAVE TO COMPILE IT AND WE HAVE TO EXECUTE IT.

          COMPILATION  IS THE FURTHER PREPARATION OF EXECUTION AND IN EXECUTION ONLY COMPUTER WORKS ON OUTPUT.


EXAMPLE PROGRAM:

                   #include<stdio.h>

                    main()

                    {

                        printf("hello");

                     }        

main();

         MAIN() IS THE IMPORTANT FACTOR IN ALL THE PROGRAMMING LANGUAGES BECAUSE, WHENEVER WE RUN THE PROGRAM THE OPERATING SYSTEM [OS] WILL ONLY SEARCH FOR MAIN(),ONCE THE MAIN() IS FOUND BY OS,THE CODES BELOW THE MAIN() STARTS TO EXECUTE.

           MAIN() IS NOTHING BUT THE BEGINNING OF THE PROGRAM AND MOST IMPORTANTLY THE CODES RETURN WRITTEN INSIDE THE MAIN() MUST ENCLOSED WITHIN PARANTHESIS{}.

printf();

           PRINTF IS USED TO PRINT THE OUTPUT.WHATEVER WE WRITE INSIDE THE PRINTF() WILL PRINT ON THE OUTPUT SCREEN.

           PRINTF IS THE INBUILD FUNCTION.THE STATEMENTS INSIDE THE PRINTF() WILL BE ENCLOSED WITH DOUBLE CODES(" ").

#include <stdio.h>;

       <stdio.h>:

               <STANDARD INPUT OUTPUT.HEADER FILE>...,  THE INBUILD FUNCTION CODE WAS ALREADY WRITTEN INSIDE IN  <stdio.h>.

         #include:

                  printf.,scanf CODES WERE ALREADY  INSIDE IN stdio.h.,SO WE ASK THE OS TO INCLUDE INPUT OUTPUT FUNCTIONS<STDIO.H>.

                  # IS NOTHING BUT PREPROCESSOR DIRECTIVE.

 
COMPILATION AND EXECUTION :

            You must be wondering why the procedure requires two steps—first, we compile the code, and then we run it. Using Turbo C and the command line or Terminal, we performed the identical action.
            The process of compilation is when the compiler determines whether the program's syntax is proper and free of mistakes, and if it is, it translates the C language source code into machine-understandable object code.
             Only the existing compiled code is executed when we run a compiled application.
             When we use the command line to start a C programme, this distinction is obvious. A.out file is created when the code is compiled, and it is then Run to run the application.
             If you make any changes to your programme after a.out file has been generated in the source code file, you must recompile the code; otherwise, the.out file will include the old source code and continue to run the old programme.

scanf () :

         In stdio, scanf in C is defined. H header file writes structured data into the memory address of variables supplied as parameters in the function call after reading the data from the standard input stream. The user has the opportunity to give the programme dynamic values whilst the programme is running thanks to the scanf function. The integer value that the scanf function returns represents the number of items that were successfully allocated to variables.

syntax of scanf() : 

          The formatted text and the memory address of the variables we want to store user-supplied input data in are the two values that the scanf function in C accepts. Let's examine the scanf() function's syntax, which is provided below:

Formula 

int scanf (const char * format string, &variable).

    


       


No comments:

Post a Comment

BEST AVR MICROCONTROLLER TRAINING IN CHENNAI - EMBEDDED SYSTEM TRAINING INSTITUTE IN CHENNAI

  Introduction In the ever-evolving field of electronics and embedded systems, AVR microcontrollers stand as epitomes of cutting-edge techno...