problem converting int to char with or without cast?
this is just a common stack with top etc... and when I print out the pop(stack) as %d with printf it prints fine and stack->top is correct when printed and all information is sent correctly to reverseStack but when I try to set tempString[inc] = pop(stack) it is returned as random ASCii nothingness and I also tried typecasting (char) pop(stack) with the same result... the point of this function is simply to temporarily store a stack as a string so it can be reloaded in the opposite order. Any help as to why this is occuring would be greatly appreciated!
int isEmpty(STACK *stack)
return (stack->top < 0);
int pop(STACK *stack)
if(stack->top < 0)
printf("\n*** Stack is empty.\n");
x = stack->number[stack->top];
void reverseStack(STACK *stack)
int i = 0, inc = 0;
tempString[inc] = pop(stack);
for(inc; inc < strlen(tempString); inc++)
push(stack, (int) tempString[inc] - 48);