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.

Wednesday, May 7, 2008

Format Specifiers

Format Specifiers:
The format specifiers are used in C programming to specify the format of the datatypes.
The various format specifiers used in C programming are as follows;

%d :
Used for getting integer.
%c : Used for getiing character output.
%f : For float value.
%l :
For long integer.
%s : For a string.

Sunday, May 4, 2008

Basic Variables

As a programmer, you will frequently want your program to "remember" a value. For example, if your program requests a value from the user, or if it calculates a value, you will want to remember it somewhere so you can use it later.
This post will show you the different types of variables (Reminder:)that are available in C. The four basic variables are int(integers,float (decimals),double (long numbers)and char (characters).
The following sample program will show you how they could be used;

#include stdio.h

int main(void)
{
int integer;
float decimal;
double longnumber;
char character;

integer = 9;
decimal = 5.6;
longnumber = 56489;
character = 'G';

return 0;
}

Now lets learn to display the contents of the different variable types.
Heres a sample program;

#include stdio.h

int main(void)
{
int integer = 9;
float decimal = 5.6;
double longnumber = 564897;
char character = 'G';

printf("The contents of the variable integer are %d\n", integer);
printf("The contents of the variable decimal are %f\n", decimal);
printf("The contents of the variable longnumber are %f\n", longnumber);
printf("The contents of the variable character are %c\n", character);

return 0;
}

The first four lines of the program declare four different variable types.The next four lines show how to display each variables content to the screen. In a standard printf statement, you use the % operator and then the proper format specifier (%d is used for integers, %f for floats and double, and %c for a character).\n is the newline character (include it anywhere in the printf statement to have cause the program to return at that point. After you have put the proper format specifier in the place where you want the variables contents displayed, then after the quotations that end what is displayed to the screen, you put a comma, then the name of the variable that is to be displayed to the screen at that point.If you want to use multiple variables in one printf statement, then you type it like so:
printf("Variable one is %d, Variable two is %d\n", variable_one, variable_two);