example c code:
#include <stdio.h>
int main (int argc, char** args) {
int k = 8;
int sendbuffer[k]; // VLA
for (int n = 0; n < k; n++) {
printf("sendbuffer[%i]: %i \n", n, sendbuffer[n]);
}
return 0;
}
example output:
sendbuffer[0]: 1
sendbuffer[1]: 0
sendbuffer[2]: 1583871280
sendbuffer[3]: 32767
sendbuffer[4]: 22544384
sendbuffer[5]: 1
sendbuffer[6]: 1713234504
sendbuffer[7]: 32767
From where do the numbers in sendbuffer[]
come from? And why are sendbuffer[2,4,6] the only ones that change when running the code again?
I'm using clang compiler on OSX El Capitan (compiling with gcc example.c
)
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
If is a different behavior with other compiler/OS, I'd like to hear about these cases too.