Re: problem passing pointer array
- From: vippstar@xxxxxxxxx
- Date: Mon, 30 Jun 2008 09:51:58 -0700 (PDT)
On Jun 30, 7:15 pm, pereges <Brol...@xxxxxxxxx> wrote:
On Jun 30, 8:59 pm, vipps...@xxxxxxxxx wrote:
Change int ***b to int **b.
Change the 'int **b' in your main() to int *b.
Wouldn't int *b lead to an array instead of array of pointers ? I
needed array of pointers hence int **b.
Sorry, I just realized that.
The problem in your original code is in this line:
(*b)[*size_ptr++]= &a[i];that increments 'size_ptr' as a pointer, not the value it points to.
Change it to (*b)[(*size_ptr)++] = &a[i];
.
- Follow-Ups:
- Re: problem passing pointer array
- From: vippstar
- Re: problem passing pointer array
- From: pereges
- Re: problem passing pointer array
- References:
- problem passing pointer array
- From: pereges
- Re: problem passing pointer array
- From: vippstar
- Re: problem passing pointer array
- From: pereges
- problem passing pointer array
- Prev by Date: Re: Runtime stack allocation
- 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
|