What is the correct way of defining the array in c? The following construction doesn’t work,
compiler gives an error “Expected Expression”:
#include <iostream>
#include <unistd.h>
#define Lookup[9][] = {"00", "01", "02", "03", "04", "05", "06", "07", "08"}
The correct way to define and initialize your array is
Each element of the array
Lookupis itself another array of 3 bytes. Counting with the zero terminator, that’s enough space for strings 2 chars long.The number of elements in the array is available with the expression
sizeof Lookup / sizeof *Lookup, as in