Skip to main content

Posts

Showing posts from April 27, 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 calle

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.