Roger
Roger

Reputation: 37

Pointer to a array of chars for string in C

I was asked this on an interview for an entry level position and was interested as to why you need two pointers. It was a phone interview and he had me write down

char **a[5]

and asked me what this was?

He told me that it was a pointer to an array of 5 characters in order to produce a string of 5 character. I am just trying to understand why its char **a[5] and not char *a[5].

Upvotes: 1

Views: 149

Answers (1)

K Scott Piel
K Scott Piel

Reputation: 4380

If you apply the right-left reading rule to that... a is an array of five pointers to a pointer to char.

Upvotes: 2

Related Questions