Lab Activity - 2

Lab Activity :
Part a)  Execute the following code and note the two output lines obtained.

{   clrscr; int a = 20 ; int * p = &amp;a; cout&lt;&lt; p ; p++; cout&lt;&lt; p;  getch; }

Part b) Execute the following code and note the two output lines obtained.

Part c) Change the Hexadecimal value obtained in parts a) and b) of the activity into its corresponding decimal values (taking help of the system scientific calculator). Part d)Subtract the first output from the second output in each case i,e part a) and part b).Observe the two results(decimal values) obtained. Is it coming 2 and 4? Why? What idea you get from it? As we can add or subtract integers from a normal variable, likewise we can also add and subtract integers from pointer variables. So all of the following statements are very correct: What happens when we increment/decrement a pointer variable by a certain value ? Note :  Arithmetic does not allow these operations. So the statements like: are invalid operations. '''What would be the output of the following code snippet and why? ''' click the link below to post your comment, response , reflections to the above question http://wikieducator.org/Talk:Lab_Activity_-2