Sunday, September 20, 2009

FILE IN C

01.WHAT IS FILE IN C?
Ans: A file is a place on the disk where a group of related data stored in. the keyword "FILE" is a data type that is defined in the I/O libary . The FILE type pointer contains all the infomation about the FILE is subsequently used as a communication link between the system and the program.

OPENING THE FILE: when working witha stream-orinted data file , the first step establish a "buffer area" ,where information is temporarily stored while being transferred between the computer's memory and data file .This buffer area allows information to be read from or written to the data file more rapidly than would otherwise be possible .
The buffer area is establish by writing
FILE *fp1 ;

Tuesday, September 8, 2009

CONSTRUCTOR (JAVA)

01.WHAT IS COSTRUCTOR IN JAVA?
ans. in java constructor initialize an object.In consturctor class name and constrructor name must be same .It has no return type even void .

CONSTRUCTOR are two type in java.i)default , ii)parameterized.

EXAMPLE:
class A{

A(){ // DEFAULT CONSTRUCTOR......
}

A(1,2,3){ //PARAMETERIZED CONSTRUCTOR...
}
}

N.B:IN JAVA COPY CONSTRUCTOR NOT SUPPORTED i,e.IN JAVA COPY CONSTRUCTOR NOTHING BUT A GENERAL CONSTRUCTOR.......

Wednesday, September 2, 2009

CALL BY REFENCE.

swapping the two no.

void main()
{
void myudf(int * , int *); //function declaration ....ansi or modern style.....
int nx , ny ;
int *px , *py ;
px = &nx ;
py = &ny ;

printf("ENTER TWO NO.S ") ;
scanf("%d %d" , px ,py);

myudf(px , py); // funtion calling.....................

printf("BACK TO MAIN: THE FISRT NO IS[%d] AT ADDR [u] SECOND IS :[%d] AT ADDR [%u] " , *px , px , *py , py );

getch();
}
//............END OF MAIN............................

void myudf( int *pnx , int *pny)
{
int z ;

z = *pnx ;
*pnx = *pny ;
*pny = z ;

printf("AT UDF : NOW THE FIRST NO. IS:[%d]AT ADDR [%u] THE SECOND NO.[%d] AT ADDR [%u] " ,*pnx , pnx , *pny , pny );

getch();
}