一个关于指针的问题.
typedef struct object_element
{
int type;
int id;
char *ptr;
} Object_element;
Object_element subject, *refs;
element_info(p_draw, &subject, PRO_IDENTIFY, -1, &refs);
printf( "ptr = %d ", refs[0].type);
printf( "ptr = %d ", refs[0].id);
if (refs[0].ptr != 0)
{
printf( "ptr = %s ", refs[0].ptr);
}
====================
element_info是个API函数
程序运行到printf( "ptr = %s ", refs[0].ptr);
的时候就出现内存问题
请问为什么呢
[解决办法]
refs[0].ptr 没有被赋给一个有效的地址