Computer Science, asked by Ayushsahini7014, 2 months ago

13.Which is the correct way to declare a pointer

Answers

Answered by prakashakash802
1

Answer:

Explanation: int *ptr is the correct way to declare a pointer.

Explanation:

Marks me as brainlist

Answered by monica789412
0

The syntax which is used in declaration of a pointer is to place asterisk before the name of the variable and it is associated with a data type too.

Declaration of a pointer:

  • A pointer is defined as a variable which holds the memory address of the another declared variable.
  • The unary operator & is used to store the address of the variable.

Syntax for declaration of  a pointer:

datatype *variable name= &variable name; (whose address is needed to be store)

For Example,

int var=10;  //Suppose it's address is 1001

int *ptr=&var;

here, int is the integer data type.

ptr is the variable name of the pointer.

var is the variable name whose address is stored in the pointer variable.

Now, *ptr is used to store the address of the variable var.

Similar questions