while it hasn't been something which really stopped me from learning, there is something which has been keeping me awake for the last few days...
What is the difference between:
#define x 5
int i; // primitive, range [−32767, +32767]
int ia[x]; // array of size[5]
// each containing one int, which has a range from [−32767, +32767]
int* ip = malloc(sizeof(int) * x); // pointer to an array, with space for five integers,
// essentially the same except for that the allocated
// memory is on the heap
// (ie will remain allocated until it is manually freed)
struct five_int { // manually defined and named datastructure, which is the same as the pointer above
int one; // memory has to be malloc'd and freed manually
int two;
int three;
int four;
int five;
}
// segmentation faults will arise with following values
i = 32768;
ia = "0, 1, 2, 3, 4, 5" // or any of the integer values being higher than 32767
ip = // same as above
five_int = // same as above
// are following values the same (except for the byte size - yup intended)?
int in = 1;
char cn = 1;
// is it possible to access a value (for example 7) in following
int is = 178;
long long lls = 178;
float fs = 17.8;