info->error, , , , , . return -1, return 0, return MAGIC_NUMBER......
" ": , . int , , , . info int data, func.
, -
if ( pop(stack, info) == SUCCESS ) {
printf("%d\n", info->data);
} else {
fprintf(stderr, "can't pop: %s\n", error_msg[info->error]);
}
:
data = pop(stack, info);
if (info->error != ERROR) {
} else {
}
By the way, you do not set info->errorto something else to 0, so your code is potentially bugged; eg.
info->error = 0;
data = pop(stack, info);
always caused an error, even if the stack is really in order, and therefore the data is valid.
source
share