Getting Started with C Language

Ad Code

Getting Started with C Language

 


C is a general-purpose language which has been closely associated with the UNIX operating system for which it was developed by Dennis Ritchie at AT & T's Bell Laboratories of USA in 1972. It is compiler based programme and set of logical instructions which are sequentially accessible.


Feature of C Program:

  • Structured language
    • It has the ability to divide and hide all the information and instruction.
    • Code can be partitioned in C using functions or code block.
    • C is a well structured language compare to other.
  • General purpose language
    • Make it ideal language for system programming.
    • It can also be used for business and scientific application.
    • ANSI established a standard for c in 1983.
    • The ability of c is to manipulate bits,byte and addresses.
    • It is adopted in later 1990.
  • Portability
    • Portability is the ability to port or use the software written .
    • One computer C program can be reused.
    • By modification or no modification.
  • Code Re-usability & Ability to customize and extend
    • A programmer can easily create his own function
    • It can can be used repeatedly in different application
    • C program basically collection of function
    • The function are supported by 'c' library
    • Function can be added to 'c' library continuously
  • Limited Number of Key Word
    • There are only 32 keywords in 'C'
    • 27 keywords are given by ritchie
    • 5 is added by ANSI
    • The strength of 'C' is lies in its in-built function
    • Unix system provides as large number of C function
    • Some function are used in operation .
    • Other are for specialized in their application

Rules for Writing, Compiling and Executing the C program
* In C all keywords are lowercased.
* Keywords cannot be used for any other purpose (like variable names).
* Every C statement must end with a ; (Semi-column) for terminator.
* First character must be an alphabet or underscore, no special symbol other than an underscore, no commas or blank spaces are allowed with in a variable, constant or keyword.
* No blank spaces are allowed within a variable, constant or keyword.
* Variable must be declared before it is used in the program.
* File should be have the extension .c
* Program need to be compiled before execution.
* Each and every program must has a main() function.
Data type in C:
Data type determines the type of data a variable will hold. C language supports 2 different type of data types.
1. Primary data types:
These are fundamental data types in C. These are: Integer (int), floating point(float), character(char), void etc.
2. Derived or user define data types:
Derived data types are grouped together like arraystuctureunion and pointer.

Integer type: Integers are used to store whole numbers.
Storing capacity and range of Integer type on 16-bit machine:

TypeStoring capacity(bytes)Range
int or signed int2-32,768 to 32767
unsigned int20 to 65535
short int or signed short int1-128 to 127
unsigned short int10 to 255
long int or signed long int4-2,147,483,648 to 2,147,483,647
unsigned long int40 to 4,294,967,295

Floating point type
Floating types are used to store real numbers, that means with float point value.
Storing capacity and range of float type on 16-bit machine

TypeStoring capacity(bytes)Range
Float43.4E-38 to 3.4E+38
double81.7E-308 to 1.7E+308
long double103.4E-4932 to 1.1E+4932

Character type
Character types are used to store characters value.
Storing capacity and range of character type on 16-bit machine

TypeSize(bytes)Range
char or signed char1-128 to 127
unsigned char10 to 255

void type
void type means no value. This is usually used to specify the type of functions which returns 0 value.

Header file in C:
A header file is a file with extension .h which contains C function declarations and macro. We must include the particular header file in our program when we use its function.
Example
#include<stdio.h>#include<conio.h> , #include<math.h> etc.

Post a Comment

0 Comments

Ad Code