C PROGRAMING: A Beginner’s Course | CHAPTER 1 Introduction and structure of C program

 Immanuel Training Institute proudly presents free software courses

To get certificate Contact: iits.certificate@gmail.com


CHAPTER 1   Introduction and structure of C program

CHAPTER 2   Data types, Constants, Variables and I/O Statements

CHAPTER 3   Operators and Expressions

CHAPTER 4   Control Statements

CHAPTER 5   Arrays

CHAPTER 6   String Manipulations

CHAPTER 7   Functions

CHAPTER 8   Structure, Unions and Enumerated Data types  

CHAPTER 9   Pointers

CHAPTER 1

PROGRAM:

            A program is a set of instruction written to carry out a particular task, so that computer can follow them. The example of the programming languages is BASIC, COBOL, FORTRAN, PASCAL, C, C++, JAVA, etc.

TYPES OF PROGRAMMING LANGUAGES:

1)     Low level

2)     Middle level

      3)     High level 

LANGUAGE TRANSLATORS:

Complier:

                        It is a program which is used to convert the high level language into machine language.

Assembler:

                        It is a program, which is used to convert the assembly language into 

                        machine language.

Interpreter:

It is a program; it takes one statement of a high level language program, translates it into machine language instruction and then immediately executes the resulting machine language instruction and so on.

C LANGUAGE HISTORY:

        ‘C’ is one of the most popular programming languages; it was developed by Dennis Ritchie at AT & T’s Bell Laboratories at USA in 1972. It is an upgraded version of two earlier languages, called BCPL and B, which were also developed at Bell Laboratories.  B was developed by Ken Thompson at AT & T’s Bell labs.

FEATURES AND APPLICATIONS OF ‘C’:

          *’C’ is a structured programming language.

          *’C’ language allows dynamic memory allocation i.e. a program can request the operating system to allocate or release memory at runtime.

         *’C’ language allows reference to a memory allocation with the help of pointers, which holds the address of the memory locations.

         *’C’ is a middle level language.       

PROGRAMMING RULES:

         * All statements in ‘C’ program should be written in lower case letters. Upper case letters are only used for symbolic constants.

         *Blank spaces may be inserted between the words. It is not used while declaring a variable, keyword, constant and function.

         *The program statement can write anywhere between the two braces following the declaration part.

         * All C statement must end with a semicolon. The user can also write one or more statements in one line separating them with a semicolon(;).

STRUCTURE OF PROGRAM

 Header file inclusion                                     (string- string.h) (+,- math.h)

 Variable declaration                                       /* global declaration*/

 main( )

{

Variable declaration;                                        /*local to main*/   (stored in stack)

Statements;                                                        

}

Sub _function ( )

{

Variable declaration;                            /*local to sub _ function ( )*/   (stored in stack)

Statements;

}

FUNCTION CONCEPT

·       C’s main structural component is the function. In c functions are the building blocks in which all the program activity occur.

·       C is divided into number of functions.

·       It must have at least one function, if it is that must be main.

·       The execution of the program starts from main.

Pre-defined function:

The definition of the function is already defined by compiler vendors, it is also called library function.

Library function - Header  files:

                       Stdio.h: contains printf and scanf.

     Conio.h: contains getch , clrscr.

     Math.h: cos, sine etc..

     String.h: strcat, strcmp, strcpy etc...

User defined function:

                     The definition of the function will be defined by the user at the time of coding. 

COMPILATION, LINKING, EXECUTION

There are two general methods by which a program can be executed. It can be compiled, or it can be interpreted. The program written language can be compiled or interpreted, some languages are designed more for one form of execution than the other. For example, Java was designed to be interpreted, and C was designed to be compiled.

Interpreter:

An interpreter reads the source code one line at a time performing the specific instruction contained in those line.In languages such as java the source code is first converted into the intermediary code and then interpreted.

Complier:

·       Complier reads the entire program and then converted into to the object code, which is a translation of the program's source code into a form that the computer can execute directly.

·       Object code is also referred to as binary code or machine code.

·       Once the program is compiled, a line of source code is no longer meaningful in the execution of your program. 

MY FIRST PROGRAM:

#include<stdio.h>

#include<conio.h>

void main()

{

clrscr();

printf("Welcome to c world");

getch();

}




TN 10TH SAMACHEER MATHS EXERCISE 2.5  SOLUTIONS


Contact Form

Name

Email *

Message *