Lab Work -1

From WikiEducator
Jump to: navigation, search

Try to Answer these (Lab Work) :

a. Create a float pointer variable fptr and a Simple integer variable var. Try to assign the address of var into fptr. Execute and infer the result.
b. The addresses of any variable is a hexadecimal value ( or an unsigned integer value ), then why do we need different data types for declaring pointers. [ Hint : Declare two or more pointer variables with different data types and try to find their individual memory size by using sizeof ( ) operator.]
c. Execute the following code (include the required header files of your own) and observe the output :
main( )
{

   int a = 35 ;
cout<< a;
int *p = &a ;
cout<< p;
getch();

}
d. A pointer variable is also a variable so it will also occupy memory space. Since it occupies a memory space it must be also having some fixed memory address. If this memory address has to be stored then what type of variables we would need? Whether it would be a normal variable, a pointer variable or something else? Explain.

click the link below to post your comment , response , reflections to the above question

  http://wikieducator.org/Talk:Lab_Work_-1