#include <iostream>
using namespace std;
void print(int a[])
{
int size = sizeof(a)/sizeof(int);
for ( int i = 0; i < size; i++){
cout << a[i] << " ";
}
}
int main()
{
int a[] = {3, 4, 5, 0, 0, 1};
print(a);
}
It's a simple function and i think my aim is obvious.Everything seems to be in order for me however function only prints the first value of the array.I tried returning size and check it's value and it is 1.This explains why it's only printing the first value of the array.
So what am i doing wrong guys?