Solution:
Code situation
Initial condition: the chain stack already exists, and there is at least one element
typedef struct
{
ElemType data;
struct LinkedStackNode* next;
}LinkedStackNode, *Linknode;
//
/*
Initial condition: the chain stack already exists, and there is at least one element
*/
int StackTop(Linknode top, int* x)
{
if(top->data == 0)
return -1;
*x = top->next->data;
return 1;
}
Analyze problems
Dereference pointers of incomplete types
The meaning here is that there are incomplete pointers. The structure and pointer belong to reference types, and the internal definition of the structure is complete. Therefore, only the structure itself is incomplete, that is:
/
//typedef struct Modify to:
typedef struct LinkedStackNode
{
ElemType data;
struct LinkedStackNode* next;
}LinkedStackNode, *Linknode;
{
ElemType data;
struct LinkedStackNode* next;
}LinkedStackNode, *Linknode;
//
/*
Initial condition: the chain stack already exists, and there is at least one element
*/
int StackTop(Linknode top, int* x)
{
if(top->data == 0)
return -1;
*x = top->next->data;
return 1;
}
Similar Posts:
- [Solved] C Programmer Error: double free or corruption (fasttop)
- About the compilation error “dereferencing pointer to incomplete type
- sorry, unimplemented: non-trivial designated initializers not supported
- PHP5.6.27 Install error: error: dereferencing pointer to incomplete type ‘EVP_PKEY’ {aka ‘struct evp_pkey_st’}
- Mybatis where 1 = 1 and Tags
- The decode function solves the problem that Oracle reports an error “divisor is 0”
- [Solved] expected specifier-qualifier-list before sth
- Wait in Linux kernel_ event_ interruptible_ Analysis of timeout interface
- [Solved] IDEA Unboxing of ‘stringRedisTemplate.hasKey(xx)’ may produce ‘NullPointerException’
- Four ways to solve selenium’s error “element is not clickable at point…”