C Basics

Data Types

User Rating:  / 5

Datatypes refer to sytem used for declaring and using variables or functions of different type. The type of variable determines space it requires.

The types in C can be categorized in following: -      

Type

Description

Basic Type

Standard and extended integer, complex and floating types.

Enumerated Type

Arithmetic types and are used to define variables that can only be assigned certain discrete integer values through out the program.

The type void

Tye type void indicates “no” value is available.

Derived Type

Pointer, Array, Structure, Union and Functions.

                                   

Add a comment

Read more...

Constants

User Rating:  / 4

The constants refer to fixed values that the program may not alter during its execution. These fixed values are also called literals.

Constants can be of any of the basic data types like an integer constant, a floating constant, a character constant, or a string literal. There are also enumeration constants as well.

The constants are treated just like regular variables except that their values cannot be modified after their definition.

Note: - we will cover secondary Constants in sebsequent chapters.       

Add a comment

Read more...

Defining Constants

User Rating:  / 2

There are two simple ways in C to define constants:

1.    Using #define preprocessor.

2.    Using const keyword.

The #define Preprocessor

Add a comment

Read more...

C Keywords

User Rating:  / 2
C Keywords 
Keywords are the words whose meaning has already been explained to the C compiler (or 
in a broad sense to the computer). The keywords cannot be used as variable names
because if we do so we are trying to assign a new meaning to the keyword, which is not
allowed by the computer. Some C compilers allow you to construct variable names that
exactly resemble the keywords. However, it would be safer not to mix up the variable
names and the keywords. The keywords are also called ‘Reserved words’. 

There are only 32 keywords available in C. Figure gives a list of these keywords for your ready reference. A detailed discussion of each of these keywords would be taken up in later chapters wherever their use is relevant
Add a comment

Read more...

Variables

User Rating:  / 2

A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in C has a specific type, which determines the size and layout of the variable's memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable.

 

Type

Description

char

Typically a single octet(one byte). This is an integer type.

int

The most natural size of integer for the machine.

float

A single-precision floating point value.

double

A double-precision floating point value.

void

Represents the absence of type.

Add a comment

Read more...

                                                                                          About Us  ||  Contact Us  ||  Terms & Conditions  ||  Privacy Policy 

Referral Banners