There are basic four data types
1. char
2. int
3. float
4. double
A variable type char is 8 bits long and can hold a character.
A variable type int holds number with no fraction.(int came from the word integer). In 16 bit environment it can hold numbers valued from -32768(to keep in mind easily by (2)^(16-1) ) to + 32768. In 32 bits environment it can hold numbers valued form -2147483648(=2^(32-1) ) to +2147483647.
A variable type float and double holds numbers with fraction. The difference between float and double is that double can hold number valued twice larger than float.
Proggramming C Basic Idea
This blog is designed for academic purpose for learning basic ideas of c programming and it will not make a professional programmer. All contents and programmes are based on my personal experience and class lecture when I was studying civil engineering in Chittagong University of Engineering and Technology (CUET). As I'm not a computer engineering student I can not assure you 100% accuracy. So I will be happy if you provide me comments and suggestions.
Monday, May 6, 2013
Control Statement
control Statements are used to create special programme features such as logical test, loopoing and branches. An example of control statement is
for(i=0;i<=n;i++)
{ sum+=i }
This means that "i" is a number which starts from 0 and ends at a number "n" which may be given to computer manually and "sum+=i" means computer has to sum present value of i with the previous.For example
for i=0 sum=0
for i=1 sum=0+1=1
for i=2 sum=1+2=3
for i=3 sum=3+3=6
for i=4 sum=6+4=10 and so on.
Note:- Here "sum" itself does not means to sum a value. It is used to keep in mind easily. It can be written in other format as "x+=i".
for(i=0;i<=n;i++)
{ sum+=i }
This means that "i" is a number which starts from 0 and ends at a number "n" which may be given to computer manually and "sum+=i" means computer has to sum present value of i with the previous.For example
for i=0 sum=0
for i=1 sum=0+1=1
for i=2 sum=1+2=3
for i=3 sum=3+3=6
for i=4 sum=6+4=10 and so on.
Note:- Here "sum" itself does not means to sum a value. It is used to keep in mind easily. It can be written in other format as "x+=i".
Compound Statement
A compound statement consists of several statements enclosed in a pair of second brackets. Such as-
{cin>>a;
sum=a+b;
cout<<sum;}
Each statement of a compound statement can be expression statement, compound statement and control statement.
{cin>>a;
sum=a+b;
cout<<sum;}
Each statement of a compound statement can be expression statement, compound statement and control statement.
Expression Statement
An expression statement consists of an expression followed by a semicolon. Such as
cin>>a>>b;
Note:- cin and cout are used in C++ but they can be used in C programming and easier to use than scanf and printf.
cin>>a>>b;
Note:- cin and cout are used in C++ but they can be used in C programming and easier to use than scanf and printf.
Statement
Statements are those which direct computer to carryout actions. Statements are of three types --
1.Expression Statement
2.Compound Statement
3.Control Statement
1.Expression Statement
2.Compound Statement
3.Control Statement
Monday, February 18, 2013
Time Sharing
Time sharing is a process which allows different users to use a single computer. The various users use the host computer through their own terminals. This terminal may be wired directly to the host computer, connected over the telephone line, a microwave circuit or earth satellite.
Machine Language:
Is the most basic language, which is the collection of detailed, cryptic instruct that contrals the computer. It is not usually used. Because 1. it is difficult to work with 2. every computer has its unique machine language. Hence the programme written in on computer may not work in another computer.
Interpreter/Compiler:
The programme written in high-level language must be translated in machine language before it execantes. An intrerpreter or compliler is a programme which accepts programme that translates the programme in machine language programme as output.
ANSI-C
Early commercial implementation of C differed somewhat from Kernighan and Ritchie's original definit. This result minor differences in different implementation of the language. These differences causes difficulty in portability that was attempted to provide. Consequently, American National Standards Institute (ANSI) has developed a standerized definition o f the C language. This is called ANSI-c
Library Funct.
Library funct carry out some commonly used calculation or operal. They are not part of the language though the implementation of the language needs them. print f(...), san f(...), tan etc are library funct.
Syntax Error:
Programming errors are often remain undeceted until the programme is executed. The syntax (or grammatical) errors are those which readily become visible as the programme is run, through these prevent from successful run of the programme. In correct punctuate, improper declare of variables.
Identifier:
Identifiers are th names given to various programme element such as funtion, variables, arrays etc.
Keywords:
Keywords are some reserved words which have standard preditermined meaning in C. Such as if, for, else etc.
Unary Operator:
In C a class of operators act upon a single operand to produce new value. These operators are called unary operator. Such as i++, i--,etc.
Array:
Array is a kind of identifier that refers to a collect of data items that all have same name. The data items must be of same type, i.e. integers, charecters, etc.
Subscribe to:
Posts (Atom)