Thursday, September 23, 2010

Declaring a Variable in C

The basic syntax for declaring a variable in C is 

                                datatype variablename
Datatype stands for the type of data of the variable it can be an integer,floating point value ,character etc.


The basic thing to understand is datatype specifies the the type of your variable whether it is a number,name or any other type of data.
                                                                                     

The primary data types in C are                                                     

1.

Integer

int

2.

Character

char

3.

Floating Point

float

4.

Double precision floating point

double

5.

Void

void


The range of values which these data types can take are given below in the table

Datatype

Range

char

-128 to 127

Int

-32768 to +32767

float

3.4 e-38 to 3.4 e+38

double

1.7 e-308 to 1.7 e+308



Read more »

Monday, September 20, 2010

How to Install and Run Turbo C++ Compiler in Windows 7 64 bit Version using DOSBox

Before going further deeply into C language i would i like to draw your attention to the old TC++ compiler which cannot be run on Windows 7 64 bit Version.

In this article i will discuss about running Turbo c++ compiler in Windows 7 64 bit OS .
TC++ compiler is a 16 bit software and cannot be run on 64 bit versions of Windows 7.But TC ++ can be run in 64 bit Windows 7 by using an x86 emulator called DOS Box.


The process of doing this is detailed below in plain text or You can watch the youtube video which i have attached



1)Download and install latest version of DOSBox from www.dosbox.com

2)Open DOSBox


A console window will open type in the following commands by referring the details given below it
___________________________________________________
mount c h:\
c:
cd tc
cd bin
tc
 ___________________________________________________

** Here "c" refers to a virtual drive you can specify any alphabet you like it doesn't matter.
** "h:\ " Refers to the drive which contains the TC Program folder
** "cd tc " command is used to change the active directory to the folder named tc which contains tc.exe and other files if you have changed the original name of this folder use that name instead of tc in this command.

3)TC will open open Options>Directories replace drive letters of all directory specifications by the drive letter you specified earlier in my case "c".
Now you can start doing your program in yur beloved Borland compiler
_For a better look please see the Youtube video i have posted_

Note:It is not recommended to use the old version of TC for doing Programs in new Operating Systems  .You can download the New Version of Turbo C or you can use free and efficient IDE like Pelles C.For More Information on Pelles C view the Post http://c-madeeasy.blogspot.com/2011/07/pelles-c-good-ide-supporting-windows-7.html

Read more »

Thursday, September 16, 2010

C programming Language

C is general purpose programming language developed for using in the Unix operating system.Now many upgraded C versions are available for instance ANSI C ,C#,C++.For a student or a programmer learning this languages are of prime concern.C programming offers extended reliability although it is platform dependent.

So,Lets look into the C programming language ,this blog will be dealing with ANSI C ,C++,C++.

Iam trying to present a new mode of learning in this blog where a small demonstrative program alon with some basic info will be used to explain you the c programming language rather than reading through chunks of material thus making learning process a fast and interesting one.

C language has a vast collection of inbuilt functions which can be used to do lots of important functions eg:printf: Output functions ,scanf:Input functions, we will be dealing with functions later.Lets begin with a simple "hello world" program

___________________________________________________________________

#include


void main()

{
printf("hello world")
}

____________________________________________________________________


In the above program print library function is used to display "hello world" .

Now lets see to the program the first line #include is used to ask the compiler to include
the standard input output function file stdio.h from the Compiler's parent directory.This file file consists of many inbuit functions.in this program we use print function(printf).Although printf is
inbuit function in c language it is good practice to include stdio.h file .

The next line voidmain() is the call for the main function it calls the main function.void keyword says that the main function does not return any value all these you will learn later.Every program in C should have a call to main function.{ brace indicate opening of main function
} brace indicate closing of main function.

The next line printf("hello world") uses print function to diplay the line hello world.This is a beginners program in C.


Read more »

Subscribe

The Source Codes Published in this Blog can be used freely for Educational purposes but should not be reproduced on any other Blog or Website without the consent of the author.