View Single Post
Old Sep 2nd, 2007, 9:42 PM   #7
cryptod
Newbie
 
cryptod's Avatar
 
Join Date: Sep 2007
Location: Algeria
Posts: 2
Rep Power: 0 cryptod is on a distinguished road
Its impossible to do it without passing the length of thr array as a parameter.
here is a possible solution :

void foo(unsigned *p, int length)
{
    cout << length << '\n';
}

int main (int argc, const char * argv[]) {
    unsigned p[] = {1,2,3,4,5,6,7,8,9,0};
int length=sizeof(p)/sizeof(p[0]) ;
    foo(p,length);
    return 0;
}

Good luck
cryptod is offline   Reply With Quote