CBSE Computer Science - Revision Tour(Solved) CBSE Guess > eBooks > Class XII > CBSE Computer Science Pointer Solved Revision Tour By Mr. Ravi Kiran COMPUTER SCIENCE POINTER 2001: 1.c) Identify the syntax error(s), if any, in the following program. Also give reason for errors.
Ans: Explonation: 1.d) Give the output of the following program segment. (Assuming all required header files are included in the program).
2 2.a) Distinguish between
Ans: The int *ptr=new int(5); declares and creates the space for the new data directly.Ie The new operator reserves 2 bytes of memory from heap memory (free pool) and returns the address of that memory location to a pointer variable called ptr, 5 is the initial value to be stored in the newly allocated memory. The int *ptr = new int[5]; initializes an array element. A memory space for an integer type of array having 5 elements will be created from the heap memory (free pool).
CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( [email protected] ) |
|