Computer Introduction To C Report
Computer Introduction To C Report
INTRODUCTION
The C programming language is a structure oriented programming language,
developed at Bell Laboratories in 1972 by Dennis Ritchie.
In 1978, Dennis Ritchie and Brian Kernighan published the first edition “The C
Programming Language” and is commonly known as K&R C.
Many of C’s ideas & principles were derived from the earlier language B,
thereby naming this new language “C”.
CHARECTERESTICS OF A C PROGRAM
• Small size- it has only 32 keywords
• It is a structured language
Database systems
Graphics packages
Word processors
Spreadsheets
Operating system development
Compilers and Assemblers
Network drivers
Interpreters
o Local Declarations
o Program Statements & Expressions
C TOKENS
In a C Program, the smallest individual units are known as C -Tokens. Programs
are written using these tokens and syntax of language. There are totally six
tokens. They are:
1. Keywords
2. Identifiers
3. Constants
4. Strings
5. Special Symbols
6. Operators
Constants: Constants in ‘C’ refer to fixed values that do not change during
the execution of a program. Constant is a memory location in which a value
can be stored and this cannot be altered during the execution of program.
‘C’ supports several types of constants. They are illustrated below.
Error in C language
ERROR
Syntax error: Some statements in the program is not a legal statement in the
language.
Runtime error: An error occurs while the program is executing, causing the
program to terminate(divide by zero, etc.)
Logical error: The program executes to completion, but gives incorrect results.
EXAMPLE:
Question: C Program to find sum of two numbers
#include<stdio.h>
int main()
{
int a,b,c;
printf("enter the value of A = ");
scanf("%i",&a);
printf("enter the value of B = ");
scanf("%i",&b);
c=a+b;
printf("The sum is = %i",c);
return 0;
}