How do I declare a pointer to an array?

Answers were Sorted based on User's Feedback



How do I declare a pointer to an array?..

Answer / sureshreddy

data_type (*ptr)[];
ex: int (*ptr)[10];

pointer to arry of 10 elements

Is This Answer Correct ?    14 Yes 3 No

How do I declare a pointer to an array?..

Answer / shruti

you do not need to declare a pointer to any array..

an array itself is a constant pointer..

a[10] is equivalent to *a.

Is This Answer Correct ?    15 Yes 4 No

How do I declare a pointer to an array?..

Answer / chittaranjan

int (*ptr)[10];
is the proper declaration of pointer to an array, i.e. ptr
is a pointer to an array of 10 integers .

Note:
int *ptr[10];
which would make ptr the name of an array of 10 pointers to
type int.

Is This Answer Correct ?    9 Yes 0 No

How do I declare a pointer to an array?..

Answer / guest

int a[10];
int *ptr=a[0];

Is This Answer Correct ?    1 Yes 0 No

How do I declare a pointer to an array?..

Answer / guest

could any one help me out how this pointer to an array
organized in the memory?

Eg.,
int (*p) [3] = (int (*)[3])a;

Here *p == p, how?

Thanks in advance!

Is This Answer Correct ?    3 Yes 4 No

How do I declare a pointer to an array?..

Answer / k.thejonath

char (*)p[100];
Here p is a pointer to an array of 100 character elements..

Is This Answer Correct ?    6 Yes 11 No

Post New Answer

More C Interview Questions

Difference between for loop and while loop?

1 Answers  


How to add two numbers with using function?

2 Answers   Miracle Solutions,


how to implement stack work as a queue?

2 Answers  


how to write a c program to print list of fruits in alpabetical order?

0 Answers  


Why c is a mother language?

0 Answers  


Is c still relevant?

0 Answers  


Explain main function in c?

0 Answers  


Where is volatile variable stored?

0 Answers  


Explain what is the concatenation operator?

0 Answers  


What is a rvalue?

0 Answers   Global Logic,


how to write a bubble sort program without using temporary variable?

1 Answers   Aricent,


which one is better structure or union?(other than the space occupied )

2 Answers  


Categories