C Programming - Complicated Declarations - Discussion
Discussion Forum : Complicated Declarations - General Questions (Q.No. 2)
2.
What do the following declaration signify?
int *ptr[30];
Discussion:
12 comments Page 1 of 2.
Ankur said:
1 decade ago
Answer c is correct.
HITESH said:
1 decade ago
No Ankur,the answer is only B coz when we declare
int *p;
then it means u declare p is a pointer to integer n when u declare
int ptr[30];
ptr is an array name to integer n here..
int *ptr[30];
ptr is a array of 30 pointers to integers.
int *p;
then it means u declare p is a pointer to integer n when u declare
int ptr[30];
ptr is an array name to integer n here..
int *ptr[30];
ptr is a array of 30 pointers to integers.
Monika said:
1 decade ago
int *ptr[30];
it is an array of size 30 that contain integer pointer i.e.
array of 30 pointers to intger.
it is an array of size 30 that contain integer pointer i.e.
array of 30 pointers to intger.
Vilas said:
1 decade ago
Yes.int *p;
then it means u declare p is a pointer to integer n when u declare
int ptr[30];
ptr is an array name to integer n here..
int *ptr[30];
ptr is a array of 30 pointers to integers.
then it means u declare p is a pointer to integer n when u declare
int ptr[30];
ptr is an array name to integer n here..
int *ptr[30];
ptr is a array of 30 pointers to integers.
George said:
1 decade ago
[B]. ptr is a array of 30 pointers to integers.
[C]. ptr is a array of 30 integer pointers.
B and C are correct. pointers to integers and integer pointers are the same. For those brand new to coding and with weak english skills , this will be really confusing!
[C]. ptr is a array of 30 integer pointers.
B and C are correct. pointers to integers and integer pointers are the same. For those brand new to coding and with weak english skills , this will be really confusing!
(1)
Prashant said:
1 decade ago
Yes. I think B and C both are same, and both answer are correct.
(1)
Sona said:
1 decade ago
A should be the answer. Because ptr is a pointer to an array of three integer to pointer.
Shine said:
1 decade ago
B and C both are same I guess. Integer pointer and pointer to integer means same. Somebody please confirm.
(1)
Shilpa said:
1 decade ago
Let p is a pointer.
Declaration:
int a;
int *p=&a;//i.e p points to the content present in address of a...
So in the similar manner,*p[2] points to the address of some to variables say a ,b..
In the similar manner *p[30] points to 30 integer variables.
Declaration:
int a;
int *p=&a;//i.e p points to the content present in address of a...
So in the similar manner,*p[2] points to the address of some to variables say a ,b..
In the similar manner *p[30] points to 30 integer variables.
Utkarsh said:
6 years ago
In declaration:
int p[20][30]; -> 20 elements each of which is an array of 30 ints.
is equivalent to int *p[30];
So, p is a pointer to an array of 30 ints.
int p[20][30]; -> 20 elements each of which is an array of 30 ints.
is equivalent to int *p[30];
So, p is a pointer to an array of 30 ints.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers