Re: problem passing pointer array
- From: pereges <Broli00@xxxxxxxxx>
- Date: Mon, 30 Jun 2008 10:08:15 -0700 (PDT)
On Jun 30, 10:00 pm, vipps...@xxxxxxxxx wrote:
You also don't check the return value of malloc. It could be NULL, in
which case you just return; the caller can check for the
successfulness of create_ptr_list(a, &b, c, &d); with if(b !=
NULL) ...
Also the design is flawed, mainly because this works only for arrays
of ints, and because 40 is hardcoded, how about you change this to
struct vector { size_t nmemb, size; void *elements; };
struct vector *remove_if(const struct vector *v, int (*remove)(void
*));
though I don't like the 'remove_if' name, I chose it because there's a
similar function in common lisp named REMOVE-IF.
Well, I wrote the function just as a test function to understand about
array of pointers. Just chose int to make things simple.
.
- References:
- problem passing pointer array
- From: pereges
- Re: problem passing pointer array
- From: vippstar
- Re: problem passing pointer array
- From: pereges
- Re: problem passing pointer array
- From: vippstar
- Re: problem passing pointer array
- From: vippstar
- problem passing pointer array
- Prev by Date: Re: Promoting unsigned long int to long int
- Next by Date: Re: Promoting unsigned long int to long int
- Previous by thread: Re: problem passing pointer array
- Next by thread: Re: problem passing pointer array
- Index(es):
Relevant Pages
|