Regarding c variables, I want to know what the x does in:
int var[x]
Regarding c variables, I want to know what the x does in:
int var[x]
This is a declaration of a Variable Length Array (VLA).
The value of expression x
(most likely, a variable) is treated as the number of array elements. It must have a positive value at the time the expression is evaluated, otherwise the declaration of the VLA produces undefined behavior.
The int defines the type of the variable, the [] defines the variable as an array, the number in the [] says the number of elements in the array. Int var[4] sets var as an array of 4 ints So, after that, var[0] is the first element, var[1] the second and var[3] the last one (index starts in 0 as you can see)