Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

are nested square brackets possible?

Tags:

c

syntax

I'm facing k&r exercise 1.24, that states: "Write a program to check a C program for rudimentary syntax errors like unmatched parentheses, brackets and braces".

I'm not sure about how to deal with square brackets.

Are nested square brackets possible in ANSI C syntax ? I haven't yet seen them so far, but I'm only at Chapter 1.

like image 401
cimere Avatar asked Dec 13 '22 06:12

cimere


1 Answers

Sure it is possible, access an array, in the place denoted in a second array. a[b[i]]

It is often used for bucket sort, where your buckets is a second array, and each bucket is an element in this array.

like image 71
amit Avatar answered Dec 23 '22 12:12

amit