The idea of programming might sound like a frightening task, but don’t worry. We designed this blog so that you can get your feet wet without stepping into the deeper complexities of the programming.
This site is dedicated to all those people who want to learn the most basic but important Programming Language'C Programming'.
If done step wise C language is easy and fun to learn.
So lets get started.
Start reading from the First Post to understand C programming.You may read a desired topic from the labels.
One of the best methods to learn any programming language is to observe as much as programs you can , try editing them.
You can take a look at the various programs on this blog and feel free to ask if any doubts in with them.
Press Ctrl+D to add this page to your Favourites/Bookmarks for further reference.
Note:Your comments,queries and suggestions are welcome.Feel free to post them in the the comment boxes available after every post.

If you are interested in learning PHP, to create your own website or to spice up your existing website;here is the Best Tutorial available for PHP

Search C Programs,Compilers,Seminars ,Projects,etc.

Friday, May 2, 2008

Datatypes

As our English Language is constructed of alphabets,words,sentences and paragraphs.
Similarly in C language a program is constructed using constants,variables and keywords.A character is the most basic element.Any alphabet,number or special symbol is a character.These characters when combined properly form constants,variables and keywords.
A 'constant' is that which never changes its value;while an 'variable' may change its value.

Constants in C programming are divided as
1)Primary Constants
2)Secondary Constants.

1)Primary Constants:
Integer, Real(Floating) and Character are the sub types of Primary constants.
Rules for writing Integer Constants:

a)It must have atleast one digit.
b)It should not contain a decimal point,as its a integer.
c)If theres no sign then a positive sign is assumed.
d)It should not contain any comma or blank space.
e)The range of integer constant is -32768 to 32767.

Ex.
454
-4256

Rules for writing Real Constants:

The real constants are also called as floating constants.
a)It must have at least one digit.
b)It must have a decimal point.
c)Default sign is positive sign.
d)Blank space or commas should not be present.

Ex.
567.65
-343.34

Rules for writing Character Constants:
a)A character constant can be a single alphabet,digit or a special symbol.
But it must be enclosed with single inverted commas.
b)The length of a character constant should be 1.

Ex.
'G'
'5'

2)Secondary Constants:
Array,Pointer,Structure,Union,Enum,etc. are secondary constants.
We'll discuss about secondary constants in some later post.




C provides a standard, minimal set of basic data types. Sometimes these are called "primitive" types. More complex data structures can be built up from these basic types.

Integer Types

The "integral" types in C form a family of integer types. They all behave like integers and can be mixed together and used in similar ways. The differences are due to the different number of bits ("widths") used to implement each type — the wider types can store a greater ranges of values.

char ASCII character at least 8 bits. Pronounced "car". As a practical matter char is basically always a byte which is 8 bits which is enough to store a single ASCII character. 8 bits provides a signed range of -128..127 or an unsigned range is 0..255. char is also required to be the "smallest addressable unit" for the machine — each byte in memory has its own address.

short Small integer — at least 16 bits which provides a signed range of -32768..32767. Typical size is 16 bits. Not used so much.

int Default integer — at least 16 bits, with 32 bits being typical. Defined to be the "most comfortable" size for the computer. If you do not really care about the range for an integer variable, declare it int since that is likely to be an appropriate size (16 or 32 bit) which works well for that machine.

long Large integer — at least 32 bits. Typical size is 32 bits which gives a signed range of about -2 billion ..+2 billion. Some compilers support "long long" for 64 bit ints.

The integer types can be preceded by the qualifier unsigned which disallows representing negative numbers, but doubles the largest positive number representable. For example, a 16 bit implementation of short can store numbers in the range -32768..32767, while unsigned short can store 0..65535. You can think of pointers as being a form of unsigned long on a machine with 4 byte pointers. In my opinion, it’s best to avoid using unsigned unless you really need to. It tends to cause more misunderstandings and problems than it is worth.



Wednesday, April 30, 2008

A simple C program

Now lets start with a simplest C program in this post.
Read the program carefully and try to understand the meaning of each statement.

Sample Program:


/* Lets begin programming */

main()

{

printf("Hi people .This is our first C program \n");

}



Explaination of the above program:

Every C program must start with the main()function.
The ';' is used as a statement terminator in C.
{ } marks the beginning and the end of a function.
/* */ encloses comments if any.
printf() is a C function for displaying variable or constant.
\n is the escape sequence for new line.

I run this program on C blocks software and here is the Output:



Sounds easy,right?
Still any question post it to the comment box.I'll be happy to resolve them.