#include <stdlib.h>
#include <stdio.h>
#include <ctime> // For time functions
#include <math.h> // For pow()
#include <iostream>
using namespace std;
int main()
{
int jiff=50;
int sizes[jiff]; //array of size jiff
sizes[49]=50; //existing, should be last position
sizes[55]=4; //should not exist
printf("it is %d\n", sizes[49]);
printf("it is %d",sizes[55]);
}
output:
it is 50
it is 4
Why doesn't my code crash? sizes[55] should be out of bounds and should crash at run-time. What gives?
EDIT: Nevermind, it crashes sometimes now, or it prints out obscurely large numbers. My new question: Why was it not misbehaving earlier? My first 5 runs were flawless for any array position up till 60