<p dir="ltr">On 1 Jan 2014 13:57, "Bart Baker" <<a href="mailto:bartbkr@gmail.com">bartbkr@gmail.com</a>> wrote:<br>
><br>
> Hello,<br>
><br>
> I'm having issues with performing operations on an array in C and<br>
> passing it back to Python. The array values seem to become unitialized<br>
> upon being passed back to Python. My first attempt involved initializing<br>
> the array in C as so:<br>
><br>
> double a_fin[max_mth];<br>
><br>
> where max_mth is an int.</p>
<p dir="ltr">You're stack-allocating your array, so the memory is getting recycled for other uses as soon as your C function returns. You should malloc it instead (but you don't have to worry about free'ing it, numpy will do that when the array object is deconstructed). Any C reference will fill you in on the details of stack versus malloc allocation.</p>

<p dir="ltr">-n</p>