how to set pointer to a memory to NULL using memset?

后端 未结 9 861
执笔经年
执笔经年 2020-12-11 08:35

I have a structure

typedef struct my_s {

   int x;
   ...
} my_T;

my_t * p_my_t;

I want to set the address of p_my_t to

9条回答
  •  执笔经年
    2020-12-11 09:19

    If I get it right, memset won't solve your problem. If A and B are separate processes, then p_my_t in process A will be different form p_my_t in process B. You just can't pass a pointer between different processes. I sugest you use some kind of IPC mechanism in order to sinchronyze your two processes (message queues, for example), and just using p_my_t = NULL instead of memset.

提交回复
热议问题