Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 12

Introduction to C

Characteristics of C
 Robust language which consists of a number of built- in
function & operators which can be used to write complex
programs
 Easy to learn
 Used in development of Software (both application/system)
C programs are efficient and fast
 Highly portable- works on different OS
 Structured programming
BASIC STRUCTURE / FUNCTIONAL UNITS OF COMPUTER
4 steps of C program

1. Writing and editing a program


2. Compiling the program
3. Linking the program with the required

library modules
4. Executing/ running the programs
Building a C program
WRITING AND EDITING PROGRAMS
 The software used to write programs is known as
a text editor.
 It is used to enter, change and store character
data.
 The completed program is known as a source file
which is input to the complier.
 Eg: Turbo C(TC), Borland C, Microsoft C/C++ ,
ANSI C, GCC,Tiny C compiler , MinGW Compiler
Compiling a C program
The job of the complier is to translate Source file to Machine level language

1. The Preprocessor
 Preprocessor reads the source code and prepares it for translator.
 The preprocessor scans for preprocessor commands and makes substitution in special
library codes.

2. The Translator
 The translates preprocessed code and results a object module is the code in
machine language.
 Translator is the one which does the actual conversion of program into machine
language.
LINKING & LOADING PROGRAMS
 The linker assembles input/output processes and
mathematical library functions and the various
files together
 To execute a program, we use an operating
system command such as run, to load the program
into primary memory (loader) and execute it.
Basic Structure of C program
Sample C programs

/* PROGRAM TO PRINT WELCOME */


#include<stdio.h>
void main()
{
printf(“Hello World”);
}
Points to remember
1. C program makes a distinction between UPPERCASE and lowercase letters
hence sum is different from SUM ,Sum
2. Only Single main () is allowed. Multiple main() is not allowed
3. Most of the statements within main and user-defined functions must end with a ‘;’
4. C is a free form language – C compiler does not care where in the line you
start typing . Hence proper indentation must be followed just for ease in
readability
5. Save all the files using a .c extention

You might also like