# C Programming - Complicated Declarations - Discussion

### Discussion :: Complicated Declarations - General Questions (Q.No.3)

3.

Declare the following statement?
"A pointer to an array of three chars".

 [A]. ``char *ptr[3]();`` [B]. ``char (*ptr)*[3];`` [C]. ``char (*ptr[3])();`` [D]. ``char (*ptr)[3];``

Explanation:

No answer description available for this question.

 Vishakan said: (Jan 23, 2011) Hi could any one help me how?

 Guest said: (Jul 30, 2011) An array of 3 characters is declares as a pointer this way only.

 Anjali said: (Aug 3, 2011) Here we should have 3 characters only but not pointers. To declare any pointer we can have the syntax like char a[3]. So here a is an array which can contain 3 characters. We are asked for pointer to array of 3 characters. So to declare it char (*ptr) [3] is the correct one. Where ptr is a pointer to an array which contains 3.

 Ganesh said: (Aug 30, 2012) Here we should have 3 characters only but not pointers. To declare any pointer we can have the syntax like char a[3]. So here a is an array which can contain 3 characters. We are asked for pointer to array of 3 characters. So to declare it char (*ptr) [3] is the correct one. Where ptr is a pointer to an array which contains 3.

 Dishendra said: (Jun 3, 2013) See if there was no star symbol then it would have been, array of 3 character. Now since since star is within parenthesis that operation is applied to whole array. So, it is pointer to array of 3 characters.

 Arjun said: (Apr 2, 2014) What will be the name of array? how can we enter values in this array?

 Dev said: (Jul 23, 2014) If we write ptr++, what will happen ?

 Ahmed said: (Nov 12, 2016) What is char (*ptr)*[3] ;? Please describe it.

 Vanitha Attada said: (Jun 2, 2017) Here, we have an array of 3 characters char a[3], we have to assign a pointer to whole elements of the array. So * in the parenthesis. And ptr is the pointer to an array. The Combination of these we will get char (*ptr) [3].

 Kingli said: (Feb 24, 2022) @All We know that ptr points to addr of the first index of the array. In order to point the ptr to every index of the array, we have to use ptr of the array such that *ptr[00]-->arr[0] *ptr[1]-->arr[1] and so on . Correct me if I am wrong.