line 27, you have to pass the pointer CF5 by reference, you are only passing it by value. I only show the corrections to a few lines. Function resize_long_pointer() will require several other corrections to accommodate the double star (pointer to a pointer)
// line 13:
void resize_long_pointer(long **,long *);
...
// line 27
resize_long_pointer(&CF5,&N_Cell_total);
// line 36
void resize_long_pointer(long **pointer,long *add_size)
Another option is to change resize_long_pointer() to return a pointer long * resize_long_pointer(long *,long *);
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
A couple of other notes:
- void main is evil . Don't use it.
- You shouldn't have your function prototype inside main(). Move line 13 to somewhere before main()
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
The only reason to pass a pointer to a pointer is so that the function can change the value of the original pointer that was declared in main().
>>for(i=1;i<= int_tmp;i++)
That line is incorrect. arrays are numbered 0, 1, ... Here is the correction
for(i=0; i < int_tmp; i++)
>>for(i=1;i<=N_Cell_total;i++)
From your original post in main() -- that line is also wrong for the same reason for(i=0; i < N_Cell_total; i++)
And don't be afraid to make liberal use of white space, it make the code easier to read.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343