Difference between Getchar( ),Getch( ) ,Getche( )

Sunday, January 31, 2010

What is difference between Getchar( ) , Getch ( ) , Getche ( ) ?

Getchar ( ) - It will accept a character from keyboard , displays immediately while typing and we need to press Enter key for proceeding.

Getch ( ) - It just accepts a keystroke and never displays it and proceeds further. Normally we use it at the end of the main ( ).

Getche ( ) - It will accept a character from keyboard , displays it immediately and does not wait for Enter key to be pressed for proceeding.

C character set, Keywords, Identifiers

C character set :-
The valid characters for C are alphabets ( A-Z, a-z) , numbers (0 - 9) and special symbols .

Reserved words ( Keywords) :-
Keywords are the words whose meaning has already been known to the C compiler. They are also called instructions. e.g. int , return
They are reserved words and can not be used as variable names.
There are 32 keywords available in C.

Identifiers
:-
Identifiers are the names you supply for variable types, functions and labels in your program.You can not use keywords as identifiers.

What is programming ?

Saturday, January 30, 2010

Let us first understand what is programming .

A program is a steps taken to perform a task or job.

A real life example will be we program our selves to come from home to college.

We have planning in our mind as when we will get up , then in how much time we will get ready, then at what time we should catch bus or train etc. We have a order of sequence for the steps we perform

i.e. we do not sit in the bus and then start brushing our teeth.

Now let us take example of addition of two numbers 22 and 33 with help of a calculator.

Our steps or program will be as follows

1. Enter 22
2. Press '+' key
3. Enter 33
4. Press '=' key
5. See the result on screen.

Similarly we can write logical steps to perform a task in computer language and execute it to get the desired result.

It will be important to understand that logical steps to perform a task remains same even if computer language changes . The only thing changes from language to language is there commands and syntax.