Q:

C# program to check a specified type is a pointer or not

0

C# program to check a specified type is a pointer or not

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program:

The source code to check a specified type is a pointer or not is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.

//C# program to check a specified type is a pointer or not. 

using System;
using System.Reflection;

class Program
{
    static void Main()
    {
        int[] Arr = new int[10];

        if (Arr.GetType().IsPointer == true)
        {
            Console.WriteLine("Arr is a pointer");
        }
        else
        {
            Console.WriteLine("Arr is not a pointer");
        }
    }
}

Output:

Arr is not a pointer
Press any key to continue . . .

Explanation:

In the above program, we created a class Program that contains the Main() method. The Main() method is the entry point for the program. Here we check the specified type is a pointer or not using the IsPointer property and then printed the appropriate message on the console screen.

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C# Basic Programs | Class, Object, Methods

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
C# program to check a specified type is an array o... >>
<< C# program to check a specified type is a primitiv...