<分区>
您好,我尝试为 SNMP Get 函数复制 Counter64 类型,但出现段错误。现在我写了一个普通的 C 函数并在 LINUX 中使用 gcc 编译我得到了这个错误
Segmentation fault (core dumped)
我在 UBUNTU 64 位 PC 上运行。请帮助解决此错误。 我的代码是
#include <stdio.h>
#include <string.h>
typedef struct SNMP_COUNTER64_TYPE {
unsigned int msn;
unsigned int lsn;
} tSNMP_COUNTER64_TYPE;
int main (void)
{
unsigned int a = 50;
unsigned int b = 20;
tSNMP_COUNTER64_TYPE *pu8RetVal;
memset(pu8RetVal, 0, sizeof(tSNMP_COUNTER64_TYPE));
pu8RetVal->msn = a;
pu8RetVal->lsn = b;
printf("\n\t%d.%d\n", pu8RetVal->msn, pu8RetVal->lsn);
}