I'm just curious what is the reason for the following error: I'm trying to determine the size of an integer array.
When I find the size of array in main function, this code returns correctly:
int program[12] = { 1007, 1008, 2007, 3008, 2109, 1109, 4300, 0, 0, 0, -99999 };
cout<<sizeof(program)/sizeof(program[0])<<"\n";
But if I pass program to a function by value, it always return 2:
void Sipmletron::load(int program[])
{
int length=sizeof(program)/sizeof(program[0])
std::cout<<length<<"\n";
memory= new int[length];
}