Assume that each diagram represents the state of the

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 0); return 0; } // This is the implementation void printNumber(int n) { cout << “The number is “ << n << endl; } This is just a good programming practice however. If you want to implement your function before the main function, you may do so. The push function will take as input your stack array, and int size which indicates the current size of your stack, and an int n, which needs to be pushed onto the stack. The function should return true if the element was successfully pushed onto the stack, and false if it could not be pushed onto the stack because the stack was already full. Note the & sign with the size variable. Do you know what this means? This means that the size variable is “passed by reference”. Whatever changes you make to this variab...
View Full Document

This lab report was uploaded on 03/02/2014 for the course CS 200 taught by Professor Fareedzaffar during the Winter '11 term at Lahore University of Management Sciences.

Ask a homework question - tutors are online