Saved Bookmarks
| 1. |
Which of the following job is done by the instruction ++*p for an integer pointer p?(a) increment value contained at address p(b) increment address contained in p(c) Both increment value contained at address p and increment address contained in p(d) neither increment value contained at address p nor increment address contained in pThis question was addressed to me by my school teacher while I was bunking the class.This is a very interesting question from Unsafe code & Pointers Basics topic in section Miscellaneous topics of C# |
|
Answer» RIGHT choice is (a) increment value contained at ADDRESS p To explain:class UnsafeCode { UNSAFE static VOID MAIN() { int n = 10; int* p = &n; Console.WriteLine(*p); } } Output : 10 +1 = 11. |
|