not possible On Fri, Sep 16, 2011 at 12:17 PM, tech coder <[email protected]>wrote:
> +1 to don > > > On Thu, Sep 15, 2011 at 9:40 PM, Don <[email protected]> wrote: > >> Not really. Usually you would need a second parameter indicating the >> size of the input. In theory it might be possible to put a marker >> value at the end of the array. >> >> Most implementations of malloc store the size of the memory block in >> the word immediately before the returned address. This is used when >> you free the memory. So some programmers use things like: >> >> int *data = (int *)malloc(n*sizeof(int)); >> >> And then later: >> int size = *(data-4)/sizeof(int); >> >> This would not work if data was declared as an array rather than as a >> malloced pointer. It is also completely implementation dependent, so I >> would not recommend it for any code which someone may someday have to >> maintain. >> >> Don >> >> On Sep 15, 10:59 am, rahul vatsa <[email protected]> wrote: >> > if i pass an int array to a function, is it possible to find out the no >> of >> > elements in the called function ? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> >> > > > -- > * > > Regards* > *"The Coder"* > > *"Life is a Game. The more u play, the more u win, the more u win , the > more successfully u play"* > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
