Friday, 12 June 2009

Renaming of function in C programming




In c we can typedef the function declaration. It is useful when function declaration is too complex and we have to give any simple name or if we have to create more numbers of function of the same type.

typedef void govinda(int);

void main(){

    govinda one,two;

    one(1);

    two(2);

    getch();

}

void one(int x){

    printf("FROM ONE %d",x);

}

void two(int y){

    printf("\

Tuesday, 9 June 2009

Why we should use the function?

1. Function reduces the redundancy of code. Example: 1 Write a c program to find the sum of: 1! /5+ 2! /4+ 3! /3+ 4! /2+ 5! /1 without using function (Except main function). Where! Symbol indicates factorial of any number. void main(){ int num, sum=0; int fact1,fact2,fact3,fact4,fact5; fact1=fact2=fact3=fact4=fact5=1; num=0; while(num<=0){ fact1 =fact1+fact1*

Friday, 5 June 2009

What is data segment?


Answer:Segment number 8 has special name which is known as data segment.
It has divided into four parts.
1. Stack area:-
All automatic variables are created into stack area.Default storage class of any local variable is auto.This variable may be int, char, float, array, pointer, struct, union etc.It also return function argument and return address.It follow LIFO data structure. It has two part

What is necessity of segmentation?

Answer:
Physical address are 20 bit.But we have no pointer of 20 bit.So pointer can not access whole residential address .So to solve this problem we have three different pointer and segmentation has done.

What is segmentation?

Answer:


Residential memory of RAM of size 1MB has divided into 16 equal part.These part is called segment.Each segment has size is 64KB.1MB=16*64KBThis process of division is known as segmentation.

What is physical address ?

20 bit address of the memory cell is known as physical address or real address.In 20 bit we can represent address from 0x00000 to 0xFFFFF.

What is residence memory in c programming ?




RAM has divided into two parts:
(1) Extended memory (useless)
(2) Residence memory : When any program is executed it is stored in the residence memory .For turbo c, it has 1MB residence memory i.e when we open turbo c it store 1MB in the RAM.