C Programming - Arrays - Discussion
Discussion Forum : Arrays - General Questions (Q.No. 2)
2.
What does the following declaration mean?
int (*ptr)[10];
int (*ptr)[10];
Discussion:
64 comments Page 6 of 7.
Kishor said:
8 years ago
Please explain me.
Shruti said:
8 years ago
Given the declaration.
int *ptr[32];
break it down as
ptr -- ptr
ptr[32] -- is a 32-element array
*ptr[32] -- of pointers
int *ptr[32] -- to int.
If the declaration is:
int (*ptr)[32];
then it would break down as
ptr -- ptr
(*ptr) -- is a pointer
(*ptr)[32] -- to a 32-element array
int (*ptr)[32] -- of int.
int *ptr[32];
break it down as
ptr -- ptr
ptr[32] -- is a 32-element array
*ptr[32] -- of pointers
int *ptr[32] -- to int.
If the declaration is:
int (*ptr)[32];
then it would break down as
ptr -- ptr
(*ptr) -- is a pointer
(*ptr)[32] -- to a 32-element array
int (*ptr)[32] -- of int.
Anonymous said:
7 years ago
Here [10] is Array of 10 integers and (*ptr) is pointer to point 10 Integers and store Addresses of 10 Integers
And here array name is ptr or same as pointer name.
And here array name is ptr or same as pointer name.
Nawinraj said:
7 years ago
Pointer is only pointer to assign array functionto 10 integers.
Ishtha said:
7 years ago
I can't get your points. Explain more please.
JAY said:
6 years ago
Could you please explain the question.
Abhishek prajapati said:
6 years ago
As we write ' int a[10] ' then we call it:- a is an array of 10 integer type elements.
Like that we can say in " int (*ptr)[10] "ptr (due to * ptr is pointer variable) is a pointer to an array of 10 integer type elements.
Like that we can say in " int (*ptr)[10] "ptr (due to * ptr is pointer variable) is a pointer to an array of 10 integer type elements.
(1)
Rupa said:
6 years ago
Could you please explain the question?
Siva said:
6 years ago
ptr is a pointer variable that can store an array of integer values(i.e. 10 integer values).
(1)
Ashik said:
5 years ago
Please explain in detail.
(1)
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers