How do I fix my code?
#include <iostream> using namespace std; int main() { //The below line fixes my code?? int hi[10][10][10] = {{10,10,10},{10,10,10},{10,10,10}}; int x[10] = {0,1}; unsigned long long next; cout << x[0] << endl; cout << x[1] << endl; for(int y=0;y<=98;y++) { next = (x[y]) + (x[y+1]); x[y+2] = next; cout << next << sizeof(int) << endl; } } So I have written this program to output the Fibonacci sequence. However I am having troubles with trying to do so as the numbers eventually reach the limit and I am looking for a work around. As a side note can someone explain why putting a multi-dimensional array fixes my code yet it does not do anything? Without it I get an output of: 0, 1, 14, 24, 34, 54, 84, 134, 214, 344, 554, 3822520894334, 1784, 1784, But with it I get an output where the loop has finished: 0, 1, 14, 24, 34, 54, 84, 134, 214, 344, 554, 894, 1444, 2334, 3774, 6104, 9874, 15974, 25844, 41814, 67654, 109464, 177114, 286574, 463684, 750254, 1213934, 1964184, 3178114, 5142294, 8320404, 13462694, 21783094, 35245784, 57028874, 92274654, 149303524, 241578174, 390881694, 632459864, 1023341554, 1655801414, 2679142964, 4334944374, 7014087334, 11349031704, 18363119034, -13237522234, 5125596804, -8111925434, -2986328634, -11098254064, -14084582694, 17766836214, 3682253524, 21449089734, -17818329714, 3630760024, -14187569694, -10556809674, 18205293604, 7648483934, -17095895434, -9447411504, 16406366034, 6958954534, -19584352404, -12625397874, 10739922694, -1885475184, 8854447514, 6968972334, 15823419844, -20157280794, -4333860954, 18458531224, 14124670274, -10366471474, 3758198804, -6608272674, -2850073874, -9458346544, -12308420414, 21182906014, 8874485604, -12892281354, -4017795754, -16910077104, -20927872854, 5111723014, -15816149844, -10704426834, 16429096294, 5724669464, -20795907214, -15071237754, 7082528004, -7988709754, -906181754, -8894891504, -9801073254,.