Interesting notes on C

Image by David Schwarzenberg from Pixabay

If you are learning C there are a number of points that may not be mentioned and possibly aren’t obvious. For instance with multidimension arrays. “The array size can be derived from its initialization but that’s applicable for first dimension only. For example, ‘int arr[][2] = {1,2,3,4}’ is valid but ‘int arr[2][] = {1,2,3,4}’ is not valid.” and “Unlike ‘long long int’, there’s nothing like ‘long long double’ in C. Besides, real data types (i.e. floatdoublelong double) can’t be unsigned.”

These and a whole lot more notes can be found here. It’s definitely worth a read. The only thought I had that was worthwhile is to do with the order of execution in a for statement.

The definition is in this order: for (initialisation, end test, alter loop variable ) statement;  but the actual order of execution is initialisation; statement; alter loop variable; end test.