Declarations in C++.

Q36. Write declarations for

  • A pointer to a character and an array of 10 integers.
  • A reference to a floating-point variables.
  • A constant character and a constant integer.

Ans.(i). char *ptr;   // pointer to a character

int arr[10];              // array of 10 integers

Ans.(ii). float var;

float &ref = var;      // reference to a floating-point number

Ans.(iii). const char var = ‘d’ ;  //constant character

const int var1 = 3 ;  //constant integer

Leave a Reply

Your email address will not be published. Required fields are marked *

51 Views
%d bloggers like this: