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

Explain the difference between structs and unions in c?

0 Answers  


Binary tree traversing

1 Answers   Qualcomm,


Explain what are reserved words?

0 Answers  


What is the difference between File pointer and Internal Charecter Pointer?

2 Answers   TATA,


#include<stdio.h> #include<conio.h> int main() { int a[4][4]={{5,7,5,9}, {4,6,3,1}, {2,9,0,6}}; int *p; int (*q)[4]; p=(int*)a; q=a; printf("\n%u%u",p,q); p++; q++; printf("\n%u%u",p,q); getch(); return 0; } what is the meaning of this program?

2 Answers  






What is the purpose of macro in C language?

0 Answers   Fidelity,


hi, which software companys will take,if d candidate's % is jst 55%?

0 Answers  


Write a program which has the following seven functions. The functions should be: • main() this calls the other 6 functions • fget_long() a function which returns a long data type from a file • fget_short() a function which returns a short integer variable from a file • fget_float() a function which returns a floating point variable from a file • fprt_long() a function which prints its single, long argument into a file • fprt_short() a function which prints its single, short argument into a file • fprt_float() a function which prints its single, floating point argument into a file. You should use fscanf() to get the values of the variables from the input (the file) and fprintf() to print the values to the other file. Pay attention to using the correct format for each of the data types.

0 Answers  


What are the disadvantages of c language?

0 Answers  


Differentiate between a for loop and a while loop? What are it uses?

0 Answers   TISL,


There is a 100-story building and you are given two eggs. The eggs (and the building) have an interesting property that if you throw the egg from a floor number less than X, it will not break. And it will always brake if the floor number is equal or greater than X. Assuming that you can reuse the eggs which didn't broke; you got to find X in a minimal number of throws. Give an algorithm to find X in minimal number of throws.

5 Answers   Yahoo,


an algorithem for the implementation of circular doubly linked list

1 Answers  


Categories