Home > Back-end >  To the structure of the data in the vs2012 used in a function but failed
To the structure of the data in the vs2012 used in a function but failed

Time:09-27

Unsigned char pp1.
//structure
Typedef struct ht_data1
{
Int a;
Unsigned char data [200].
Unsigned char * p;
} ht_data;

//function 1
Int Cht_csDlg: : HTTT (unsigned char) p
{
Ht_data * h;

H=(ht_data *) p;

I=h - & gt; Data [9].//procedures to die in this

return 0;
}
//function 2
Int Cht_csDlg: : ZLX (unsigned char * p)
{
Ht_data * h=NULL;
int i;
HANDLE heapHandle;


HeapHandle=HeapCreate (0, 100, 0).
H=(ht_data *) HeapAlloc (heapHandle HEAP_ZERO_MEMORY, 100);

* p=(unsigned char) h;
for(i=0; i<30; I++)
H - & gt; Data [I]=I;

return 0;
}

//the function 1, function 2
Void Cht_csDlg: : OnBnClickedButton1 ()
{

ZLX (& amp; Pp1);
HTTT (pp1);
}
I want to achieve in function 2 define the structure of the data in the data array, and then pass a pointer, the structure address and then through the pointer in the address of the structure to the function structure of 1, but the transfer failed, at which the great spirit to see which piece not be appreciated

CodePudding user response:

With double pointer, pointer to a pointer,

CodePudding user response:

Upstairs can master said some fine, best can help me to look at the code is an issue which block, pointer to this I am not very familiar with
  • Related