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

What is pointer in c?

0 Answers  


Is using exit() the same as using return?

0 Answers  


‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .

0 Answers  


15.what is the disadvantage of using macros? 16.what is the self-referential structure? 17.can a union be self-referenced? 18.What is a pointer? 19.What is the Lvalue and Rvalue? 20.what is the difference between these initializations? 21.Char a[]=”string”; 22.Char *p=”literal”; 23.Does *p++ increment p, or what it points to?

1 Answers  


void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }

0 Answers  






Write a program of advanced Fibonacci series.

0 Answers   Aspiring Minds,


Simplify the program segment if X = B then C ← true else C ← false

0 Answers  


Are negative numbers true in c?

0 Answers  


Explain what does the format %10.2 mean when included in a printf statement?

0 Answers  


What are the 32 keywords in c?

0 Answers  


Is array name a pointer?

0 Answers  


24.what is a void pointer? 25.why arithmetic operation can’t be performed on a void pointer? 26.differentiate between const char *a; char *const a; and char const *a; 27.compare array with pointer? 28.what is a NULL pointer? 29.what does ‘segmentation violation’ mean? 30.what does ‘Bus Error’ mean? 31.Define function pointers? 32.How do you initialize function pointers? Give an example? 33.where can function pointers be used?

2 Answers  


Categories