2

What is the difference between the following statements?

char *a[10];

char (*a)[10];
Lundin
  • 195,001
  • 40
  • 254
  • 396

2 Answers2

6

The former is an array of 10 char pointers. The latter is a pointer to an array of 10 char's.

Magisch
  • 7,312
  • 9
  • 36
  • 52
machine_1
  • 4,266
  • 2
  • 21
  • 42
1
char *a[10];

This declares array of 10 pointers to char .

Whereas , this -

char (*a)[10];

declares pointer to array of 10 char's

ameyCU
  • 16,489
  • 2
  • 26
  • 41