ok wow im having a lot of problems with this code. i tried what you said to initialize it but im getting 3 errors:
Code:
error C2057: expected constant expression
error C2466: cannot allocate an array of constant size 0
error C2440: 'initializing' : cannot convert from 'int' to 'int []'
and when i take that part out to try to use the pointer to view 1 section of it it just shows the whole thing.
heres my code now:
Code:
#include <iostream>
using namespace std;
int main ()
{
int a;
int array [7];
int *z;
z = array;
for (int i = 0; i < 7; i++)
{
int array [i] = i;
}
cout<< "press 1 to see the whole array, press 2 to pick one slot.\n";
cin>> a;
switch (a) {
case 1:
cout<< "this be yo' array dawg:\n";
cout<< ""<< array <<"\n";
break;
case 2:
cout<< "which slot would you like to view? 0-6\n";
cin>> *z;
cout<< array [*z];
break;
default:
cout<< "NO\n";
break;
}
cin.get();
}