T thanhthao New member Sep 21, 2021 #1 What will be the output of the following C# code snippet? Code: class UnsafeCode { unsafe static void Main() { int a = 2; int b = 4; int *a1 = &a; int *b1 = &b; Console.WriteLine(*a1 + *b1); } } A. 6 B. print garbage value C. print -6 D. print address of b + a
What will be the output of the following C# code snippet? Code: class UnsafeCode { unsafe static void Main() { int a = 2; int b = 4; int *a1 = &a; int *b1 = &b; Console.WriteLine(*a1 + *b1); } } A. 6 B. print garbage value C. print -6 D. print address of b + a
S Sơn Lê Member Sep 21, 2021 #2 Answer: a Explanation: The (*) operator prints the value stored at address (&) of ‘a’. Output : Code: 4 + 2 = 6 Upvote 0 Downvote
Answer: a Explanation: The (*) operator prints the value stored at address (&) of ‘a’. Output : Code: 4 + 2 = 6