need to spot the error in this program

#include <iostream>

using namespace std;

int main()
{
int flag=0;
int i_ary[]= {10, 20, 30};

cout<<"size of array="<<sizeof(i_ary); //this should print 12 but it prints 4 in function if we pass as a parameter. Why?

cin>>flag;
return 0;
}


its supposed to print 12 but prints 4 if i pass the parameter.. why does it happen?

can anyone explain thanks
Don't post code that does not reproduce the problem (also, use code tags)
it is counting 0,1,2,3 3 being the end of the array. so that is 4. why do you think the array should be 12?
Topic archived. No new replies allowed.