双层指针的使用
作者:互联网
双层指针一般不被使用。
目前只遇到过以下情况需要使用:
需要通过函数调用去修改一个指针的时候。
数据结构:
struct HashInfoType{ uint32_t StartAddr; uint32_t SizeSendby0x34; uint32_t expandedSize; /* for un-compressed data, it's equal to SizeSendby0x34; for compressed data, it's much bigger than SizeSendby0x34 */ uint32_t AccumulatedSha256Size; /* */ unsigned char HashValueArray[32]; }; struct HashInfoTypeArray{ uint16_t blockIndex; //private variable. struct HashInfoType content[MAX_TRANSFER_DATA_BLOCKS]; };
/* * In order to modify the following variable. * hash_value_arrays[] * double pointer syntax is used. * * */ int signv_find_hashvalue_by_addr(uint32_t addr, unsigned char **hash_value_arrays) { int i; int ret = -1; //0 means OK for(i = 0; i < blocksHash.blockIndex; i++) { if(blocksHash.content[i].StartAddr == addr) { *hash_value_arrays = &(blocksHash.content[i].HashValueArray[0]); ret = 0; break; } } return ret; }
标签:双层,addr,int,value,blocksHash,使用,hash,uint32,指针 来源: https://www.cnblogs.com/praiseslow/p/15720960.html