Saturday, July 23, 2011

Keywords in C

Every programming language reserves some words usually referred as "keywords" for the use of compilers and these keywords cannot be used by programmers as variables. There are 32 keywords in c and we will discuss them in detail at later stage, but now let us have a look at them.. These are as follows:

auto

double

int

struct

break

else

long

switch

case

enum

register

typedef

char

extern

return

union

const

float

short

unsigned

continue

for

signed

void

default

goto

sizeof

volatile

do

if

static

while

Sunday, April 10, 2011

Datatypes in C and C++

The basic datatypes available in C and C++ are integers, floats, characters, and strings. Integers can be short or long. Short integers uses two bytes to store the number, whereas long integers use four bytes to stores integer values. Therefore the range of short integers is -32768 to +32767 and that of long integers -2147483647 to +2147483647

Character datatype can hold single characters like 'a' or 'b'. Character variables use one byte of storage.

Strings datatype is used to hold a set of characters together like name of a person "sam". It is necessary of use cotation marks on both sides of string to indicate that it is string.

Datatype float is used to hold floating point numbers or numbers with decimal points like 4.50 or 5.80. These decimal ponit numbers cannot be storeds into integer variables, and if we assign any floating point number to an integer then only integer part of the float number will get assigned to the variable. So it is necessary to use flaot variables to store floating point numbers.

C constants and variables

A constant in C is a entity which never changes its value during the program execuation, whereas variables in C and C++ change their values during program execution. Examples of constants are numerals like 5,10, or 15 and there can be character constant also in C and C++ like 'a' or 'b'. These constant require some name to be associated with them so they can be used in computations. If we want to add 5 and 10 we can do so by using the expression like 5+10, but there is another way to do so with the help of variables. Before using a variable it should be declared. Variable declaration statement in C and C++ inlcudes the datatype and the name of variable like following:

Int number
char alphabet
Here number is a variable of type Integer which can hold integer values. In the same way alphabet is a variable of type Char which can hold Character values.

Sunday, April 3, 2011

C and C++ Language

C languiage was developed in the 70s and still has no true replacement. C and C++ are among the sidely used programming languages in the software industry, but having grip on C and C++ programming is not easy as compared with other programming languages like VB and Oracle. C and C++ are basically used in system programming and also in embedded systems and games development. One need to have indepth knowlwdge of system hardware to efficiently exploit the capabilities of these languages.