Why my code is giving an error?

#include
#include
using namespace std;
vector fun(int a[])
{
vectorb;
int n=sizeof(a)/sizeof(int);
for(int i=0;i<n;i++)
b.push_back(10*a[i]);
for(int variable : b)
cout<<variable<<" “;
cout<<endl;
return b;
}
int main()
{
int a[]={1,2,3,4,5};
vectortemp=fun(a);
for(int variable : temp)
cout<<variable<<” ";
return 0;
}

hi @namangarg31
The error is

In C++, array parameters are treated as pointers . So the expression sizeof(arr)/sizeof(arr[0]) becomes sizeof(int *)/sizeof(int) which results in 1 for IA 32 bit machine (size of int and int * is 4) and the for loop inside fun() is executed only once irrespective of the size of the array.

i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course