Little backgound. I'm working on a homework project, don't worry I don't just want it done for me. It need to have two procedures which take no input when called and return no data. They share a memory location and that hold one integer value. The point is to have these procedures called in any randon order have them call int peek() to retrive the value in the shared mem. And call void poke(int value) to put the next value in. Once poked that value is output to the screen. Here is the trouble. It needs to print out the sequence 1,2,3,....,10,9,8,....,1,0. There can be no static variables. My instructor provided peek, poke and the random function caller. The two procedures will be identical. I know that one will be called, placed on the stack and then remoced from the stack. Then the next one will be called and go into that recently vactaed stack space. I want to leave a bool on the stack to tell the procedures whether or not to poke the next higher or lower number than it peeked.
Question1: Is my reasoning sound? I'm pretty sure it is, but if you can tell why not, I'll believe you.
Question two: How can I access that bool value that I want to leave on the stack without passing anything between the procedures?
This is must compile on a linux box, with gcc.