Sunteți pe pagina 1din 11

C The Programming

Language
By Dennis Ritchie
Getting started
• Developed at AT & T’s Bell Laboratories by Dennis Ritchie in 1972
• C++,C#, Java make use of principal called OOP(object Oriented
programming) to organize the program.
• Major parts of popular operating systems like Windows, Linux , UNIX ,
and android are written in C.
• Smart Device’s smartness comes from microprocessor , operating
system and a program embedded in these devices. These program
not only have to run fast but also have to run in a limited amount of
memory.
• Many popular gaming frameworks (eg. DirectX) have been built using
C language.
Getting started with C

• AlphabetWordsSentenceParagraph
Steps in learning
English language-

• Alphabets constants
Steps in • Digits  variables InstructionsProgram
learning C • Special symbols keywords
language-
The C Character Set

Alphab A,B,C,…………,Y,Z
a,b,c,………….,y,z
ets
Digits 0,1,2,3,4,5,6,7,8,9
Special ~ ‘ ! @ # % ^ & * () _ - + = | \ {} [] :
Symbols ; “ ‘ < > , . ? / $
Constants variables and
keywords
• A constant is an entity whose value doesn’t change,
whereas, a variable is an entity whose value may
change. A keyword is predefined which has a special
meaning.
• A computer saves values in memory locations to recall
these values we give a name to these location and call
them variables.
• In Programming language, Constants are often called
literals, whereas variables are called identifiers.
Types of Constants
Constants
• Integer-An Integer must have at least one digit.It must not have a
decimal point.It can of any zero,positive,negative. eg. 432, 56, -45 etc.
• Real Constants-In two forms Fractional Form and Exponential Form.
• In exponential form, the real constant is measured in two parts.The
part appearing before ‘e’ is called mantissa, whereas the part
following ‘e’ is called exponent.
• Eg. 0.0000034 can be written as 3.4e-6 i.e 3.4x10^-6.
• Character-A character constant is a single alphabet, a single digit or a
single special symbol enclosed within a single inverted comma eg. ‘A’.
C Variables
• A particular type of variables can hold only the same type of constant for
example An interger variable can hold only an interger constant.
Rules for constructing variables names
1. A variable name is any combination of 1 to 31 alphabets , digits or underscores.
2. The first character in the variable name must be an alphabet or an underscore(_).
3. No commas or blanks are allowed within a variable name.
4. No special symbol other than underscore can be used in variable name.
Examples- int si, m_hra;
float basal;
char code;
C Keywords
• Keywords are the word whose meaning are already has been defined or
explained to the compiler.
• There are only 32 keywords available in C.

auto double int struct


break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while
A Basic program to calaulate

Simple Interest
/*Calculation of simple interest*/
• #include<stdio.h>
• int main()
• {
• int p,n;
• float r,si;
• P=1000;
• N=3;
• R=9.7;
• /*formula of simple interest*/
• si=p*n*r/100;
• Printf(“%f\n”,si);
• return 0;
• }

S-ar putea să vă placă și