H
hudaiqian
hi,all I encounter a problem with sizeof
template <typename type>
void display(type& a)
{
cout<<sizeof(type)<<":"<<a[0]<<endl;
}
int main()
{
int a[6] = {1,2,3,4,5,6};
display(a);
}
the output is 24:1, its means is sizeof(type) equals 24,but the type
here is int
24 is the sizeof array a,why?Thanks
template <typename type>
void display(type& a)
{
cout<<sizeof(type)<<":"<<a[0]<<endl;
}
int main()
{
int a[6] = {1,2,3,4,5,6};
display(a);
}
the output is 24:1, its means is sizeof(type) equals 24,but the type
here is int
24 is the sizeof array a,why?Thanks