<div>Say you have a struct.</div>struct my_c_struct {};<div>my_c_struct *ptr = 0; // uninitialised pointer</div><div><br></div><div>You need to prototype the function with a pointer to a pointer
</div><div>void my_func(my_c_struct **pptr);</div><div><br></div><div>void my_func(my_c_struct **pptr)</div><div>{</div><div> *ptr = new my_c_struct;</div><div> if (!*ptr) printf ("error no memory\n");</div>
<div> else printf ("aye memory\n");</div><div>}</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br><br><div class="gmail_quote">On 10 June 2012 01:57, Vince Kuyatt <span dir="ltr"><<a href="mailto:vince.raiken@gmail.com" target="_blank">vince.raiken@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I need to be able to define a variable which is an un-initialized pointer to a C struct, then pass a reference to that pointer to a C function. How would I go about doing this?
<br>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br></div>