// example
#include <iostream>
using namespace std;
size_t bsearch(int *a) {
cout<<a<<endl;
cout<<sizeof(a) / sizeof(a[0])<<endl;
return 1;
}
int main() {
int a[] = {1,3,5,7,9,11};
cout<<a<<endl;
cout<<sizeof(a) / sizeof(a[0])<<endl;;
cout<< bsearch(a);
}
why they are difference ?
a has the same value, but why sizeof(a) / sizeof(a[0]) is difference?
thanks
#include <iostream>
using namespace std;
size_t bsearch(int *a) {
cout<<a<<endl;
cout<<sizeof(a) / sizeof(a[0])<<endl;
return 1;
}
int main() {
int a[] = {1,3,5,7,9,11};
cout<<a<<endl;
cout<<sizeof(a) / sizeof(a[0])<<endl;;
cout<< bsearch(a);
}
why they are difference ?
a has the same value, but why sizeof(a) / sizeof(a[0]) is difference?
thanks
Comment