Passing values to arrays? Weird output?
i made a simple porgram to create an array of 52 values, and then pass those values to another array.
Code:
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int deck[51];
for (int i=0; i<=51; i++)
deck[i]=i;
int n[51], s[51], e[51], w[51];
for (int i=0, f=0; f<=51; f+=4)
{
n[f]=deck[i];i++;
s[f]=deck[i];i++;
e[f]=deck[i];i++;
w[f]=deck[i];i++;
}
for (int i=0; i<=12; i++)
cout << n[i]<<" ";
system("PAUSE");
return EXIT_SUCCESS;
}
now the output for this program should be "1 5 9... etc etc" but what i am getting is.
Quote:
0 2359672 2 0 4 -2141844640 6 -1410036744 8 -1410036744 10 2 12 65536 14 15 16 1 18 3 20 5 22 7 24 9 26 11 28 13 30 15 32 17 34 19 36 21 38 23 40 25 42 27 44 29
46 31 48 33 50 35
wtf?