Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

int (*p) [4]?

Tags:

c++

int (*p) [4] ;

Is "p" pointer to array of 4 integers ?? or what ??

and How can I call "new" for this pointer ??

like image 647
Farah_online Avatar asked Aug 01 '10 17:08

Farah_online


People also ask

What is the meaning of int (* a 3?

The int *(a[3]) is the same as plain int *a[3] . The braces are redundant. It is an array of 3 pointers to int and you said you know what it means. The int (*a)[3] is a pointer to an array of 3 int (i.e. a pointer to int[3] type). The braces in this case are important.

What is the meaning of (* ptr )*= 10?

int (*ptr)[10] - pointer to an array of integers. int* ptr[10] - an array of int pointers. Array of pointers. pointer may be arrayed like any data type. To assign the address of an integer variable called var to third element of the pointer array, write.

What is the significance of int (* p?

int (*p)(): Here “p” is a function pointer which can store the address of a function taking no arguments and returning an integer. *p is the function and 'p' is a pointer.

What is the purpose of P in the following statement int (* p 3 ]) ();?

For int (*p)[3]: Here “p” is the variable name of the pointer which can point to an array of three integers.


1 Answers

Is "p" pointer to array of 4 integers?

Correct!

How can I call "new" for this pointer?

For example, p = new int[7][4].

like image 77
fredoverflow Avatar answered Oct 25 '22 03:10

fredoverflow