C is a middle level computer language developed by Dennis MacAlistair Ritchie & Brian Wilson Kernighan (he later joined Denis)
at AT & T's Bell Laboratories of USA in 1972. It's called middle level because; it combines the best elements of high level language with the machine effectiveness of assembly language. As a middle level language C is partly portable, that means it is easy to adapt software written for one type of computer system or operating system to another.

C is a structured language. The distinguishing features of a structured language are COMPARTMENTALIZATION of code & data. This is the ability of a language to section off data & hides from the rest of the program. As a structured language C supports several loop constructs, such as while, do-while, and
for.
Here use of go-to
statement is prohibited.

A character denotes any alphabet, digits or special symbol used to represent information. The following table shows the valid alphabet, digits or special symbol used in C:-

Alphabets

A, B, C…………X, Y, Z & a, b, c…………..x, y, z

Digits

0,1,2,3,4,5,6,7,8,9

Special Symbols

~ ' ! @ # % ^ & * ( ) _ - + = \ { } [ ] : ; " < > , . ? /


Hierarchy of Operations: -
The priority or precedence in which the operations in an arithmetic statement are performed is called the hierarchy of operations. It's as follows:-

Priority

Operators

Description

1st

* / %

Multiplication, division, modular division

2nd

+ -

Addition, subtraction

3rd

=

Assignment


C supports the concept of data type. A data type defines a set of values that a variable can store along with a set of operations that can be performed on that variable. There are five basic build in data types in C, namely integer (int), character (char), floating point (float), double-precision point (double) and void. Many C-compilers also offer extended data types such as long int & long double. As you will see all other data types in C, are based upon one of this types. All data types defined in ANSI/ISO C Standard are as follows:-

TYPE

TYPICAL SIZE IN BITS

MINIMAL RENGE

char

8

-127 to 127

unsigned char

8

0 to 255

signed char

8

-127 to 127

int

16(in 16-bit environments, like DOS, Windows 3.1) or 32(in 32-bit environments like Windows NT)

-32,767 to 32,767

unsigned int

16(in 16-bit environments, like DOS, Windows 3.1) or 32(in 32-bit environments like Windows NT)

0 to 65,535

signed int

16(in 16-bit environments, like DOS, Windows 3.1) or 32(in 32-bit environments like Windows NT)

-32,767 to 32,767

short int

16

-32,767 to 32,767

unsigned short int

16

0 to 65,535

singed short int

16

-32,767 to 32,767

long int

32

-2,147,483,647 to 2,147,483,647

singed long int

32

same as long int

unsigned long int

32

0 to 4,294,967,295

float

32

Six digits of Precision

double

64

Ten digits of Precision

long double

80

Ten digits of Precision


Constants refer to fixed values that do not change during the execution of a program.C supports several types of constants, i.e. integer constants (128, -4590 etc), real constants (15.96, 0.236 etc), single character constants ('5', 'X', ' ' etc) & string constants ("Welcome", "1986" etc).Variable is a named location in memory to hold a value that may be modified in the time during program execution. The general form of variable declaration is


type
variable_list;

Type declaration instruction is used to declare the types of variables being used in a program. Any variable used in the program must be declared before using it. The type declaration statement is written at the beginning of main() function. As for example:-

int
age;

float average;

char
name, password;

Variable will be declared in three places in a program: - 1.Inside Functions (Local variable) 2.In the definition of Function Parameter (Formal Parameters) & 3. Outside of all Functions (Global variables).

There are some rules in writing variable name: -


1) They must begin with either alphabets or underscore ( _ ).

2) ANSI standard recognizes a length of 31 characters.

3) Uppercase & lowercase are significant. It should not be a keyword. White space not allowed.

Keyword has fixed meaning predefined in the system, it can't be changed. It serves as the basic building blocks for program statements. All keywords must be written in lowercase. C has 32 keywords (of these, 27 were defined by the original version of C.This five: - void, emun, volatile,
const & signed, are added later by ANCI C committee)
as follows:-

auto

double

int

struct

break

else

long

switch

case

emun

register

typedef

char

extern

return

union

const

float

short

unsigned

continue

void

signed

for

default

goto

sizeof

volatile

do

if

static

while


Now let's do your first program:-

#include<stdio.h>

void main ()

{

printf ("WELCOME");

printf("/nTHANK YOU");

}

Explanation: - Each instruction in C program is written as separate statements. #include is preprocessor directive. main () is a user define function & all codes enclosed within {}.printf() is a function for printing data in terminals. /n represents the new line character.

POSTED BY:-Satyabrota

Posted by Satyabrota

0 comments: