?
What will be the output of the following C# code snippet?
What will be the output of the following C# code snippet?
class UnsafeCode
{
unsafe static void Main()
{
char[] arr = { 'A', 'B', 'C', 'D', 'E' };
fixed (char* P = arr)
{
int i;
for (i = 0 ;i < 5 ;i++)
if (*P % 2 == 0)
++*P;
else
(*P)++;
Console.WriteLine(arr);
}
Console.ReadLine();
}
}
class UnsafeCode
{
unsafe static void Main()
{
char[] arr = { 'A', 'B', 'C', 'D', 'E' };
fixed (char* P = arr)
{
int i;
for (i = 0 ;i < 5 ;i++)
if (*P % 2 == 0)
++*P;
else
(*P)++;
Console.WriteLine(arr);
}
Console.ReadLine();
}
}
Join the Discussion
Login to post a comment or share your explanation.
Login