/* Arrays * * See https://en.cppreference.com/w/c/language/array.html */ /* * Storage class */ //! Global, complete, not initialised int arr0[3]; //! Global, complete, initialised int arr1[] = {1, 2, 3}; //! Global, extern, complete, not initialised extern int arr2[3]; //! Global, extern, complete, initialised extern int arr3[] = {2, 3, 4}; //! Global, static, complete, not initialised static int arr4[3]; //! Global, static, complete, initialised static int arr5[] = {3, 4, 5}; //! Global, incomplete int arr6[]; //! Global, extern, incomplete extern int arr7[]; //! Global, static, incomplete static int arr8[3]; /* * Types */ typedef int triplet[3]; typedef int list[]; typedef int matrix[4][3]; typedef int tripletlist[][3]; struct Example { int triple[3]; int sudoku[3][3]; }; //! Typedef-in-typedef typedef triplet sudoku[3]; /* * Globals */ //! Array of known size extern int arr_1[3]; //! Array of known size, typedef extern triplet arr_2; //! Array of unknown size extern int arr_3[]; //! Array of unknown size, typedef extern list arr_4; //! Multi-dimensional array of known size extern int arr_5[4][3]; //! Multi-dimensional array of known size, typedef extern matrix arr_6; //! Multi-dimensional array of unknown size extern int arr_7[][3]; //! Multi-dimensional array of unknown size, typedef extern tripletlist arr_8; /* * Globals: const */ //! Array of known size extern const int arr_1_const[3]; //! Array of known size, typedef extern const triplet arr_2_const; //! Array of unknown size extern const int arr_3_const[]; //! Array of unknown size, typedef extern const list arr_4_const; //! Multi-dimensional array of known size extern const int arr_5_const[4][3]; //! Multi-dimensional array of known size, typedef extern const matrix arr_6_const; //! Multi-dimensional array of unknown size extern const int arr_7_const[][3]; //! Multi-dimensional array of unknown size, typedef extern const tripletlist arr_8_const; /* * Function arguments */ //! Array of known size int fun_1(int x, int xs[3]); //! Array of known size, typedef int fun_2(triplet xs); //! Array of unknown size int fun_3(int xs[]); //! Array of unknown size, typedef int fun_4(list xs); //! Multi-dimensional array of known size int fun_5(int xss[4][3]); //! Multi-dimensional array of known size, typedef int fun_6(matrix xss); //! Multi-dimensional array of unknown size int fun_7(int xss[][3]); //! Multi-dimensional array of unknown size, typedef int fun_8(tripletlist xss); //! Typedef-in-typedef int isSolved(sudoku xss); /* * Function arguments: const */ //! Array of known size int fun_1_const(int x, int xs[3], const int ys[3]); //! Array of known size, typedef int fun_2_const (triplet xs, const triplet ys); //! Array of unknown size int fun_3_const (int xs[], const int ys[]); //! Array of unknown size, typedef int fun_4_const (list xs, const list ys); //! Multi-dimensional array of known size int fun_5_const (int xss[4][3], const int yss[4][3]); //! Multi-dimensional array of known size, typedef int fun_6_const (matrix xss, const matrix yss); //! Multi-dimensional array of unknown size int fun_7_const (int xss[][3], const int yss[][3]); //! Multi-dimensional array of unknown size, typedef int fun_8_const (tripletlist xss, const tripletlist yss); //! Typedef-in-typedef int isSolved_const (sudoku xss, const sudoku yss); /* * Function results * * NOTE: an array can not be returned directly from a function, so we return a * pointer to the array instead. Note that it is atypical for C code to return * pointers to arrays from functions, but for completeness we include these * examples here anyway. */ //! Array of known size int (*fun_9(void))[3]; //! Array of known size, typedef triplet *fun_10(void); //! Array of unknown size int (*fun_11(void))[]; //! Array of unknown size, typedef list *fun_12(void); //! Multi-dimensional array of known size int (*fun_13(void))[4][3]; //! Multi-dimensional array of known size, typedef matrix *fun_14(void); //! Multi-dimensional array of unknown size int (*fun_15(void))[][3]; //! Multi-dimensional array of unknown size, typedef tripletlist *fun_16(void); //! Typedef-in-typedef sudoku * solve(void);