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 the use of ‘auto’ keyword?

1 Answers  


what is uses of .net

0 Answers  


What is structure padding and packing in c?

0 Answers  


WHY DO WE USE A TERMINATOR IN C LANGUAGE?

2 Answers  


Give a fast way to multiply a number by 7

15 Answers   Accenture, Aricent, Microsoft,






What is null character in c?

0 Answers  


Why main is used in c?

0 Answers  


what is the diffrenet bettwen HTTP and internet protocol

0 Answers  


how to set Nth bit of a variable?

1 Answers  


Is null always defined as 0(zero)?

0 Answers  


Look at the Code: #include<string.h> void main() { char s1[]="abcd"; char s2[10]; char s3[]="efgh"; int i; clrscr(); i=strcmp(strcat(s3,ctrcpy(s2,s1))strcat(s3,"abcd")); printf("%d",i); } What will be the output? A)No output B) A Non Integer C)0 D) Garbage

7 Answers   Accenture,


Is c is a high level language?

0 Answers  


Categories