[OT] Can global variable be passed into Python function?

Michael Torrie torriem at gmail.com
Mon Feb 24 19:19:28 CET 2014

On 02/24/2014 11:05 AM, j.e.haque at gmail.com wrote:
> typedef struct {
>   int value;
> } Number;
>   Number *o;
>   o = malloc(sizeof(*o));
>   o->value=3;
>   printf("o<%p>, o->value<%p>\n", o, &o->value);
> o<0x9fe5008>, o->value<0x9fe5008>
> Is the compiler borked?

Why would you think that? The address of the start of your malloc'ed
structure is the same as the address of the first element.  Surely this
is logical?  And of course all this is quite off topic.

More information about the Python-list mailing list