What Will Be The Output Of The Following C Code Segmentp Pre #833
What will be the output of the following C# code segment?</p> <pre><code class="language-csharp" line="1"> class UnsafeCode { unsafe static void Main() { int n = 10; void* p = &n; Console.WriteLine(*p); Console.ReadLine(); } } </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs108 CSharp. It can also be found in gs gs108 Miscellaneous Topics - Unsafe Code Pointers Basics - Quiz No.1.
What will be the output of the following C# code segment?
class UnsafeCode { unsafe static void Main() { int n = 10; void* p = &n; Console.WriteLine(*p); Console.ReadLine(); } }
The program will print 10
Run time error
Compile time error
Output is the address contained in p