C
ProgrammingTo ensure that programs are "correct", it must be usefull to use assertions as illustrated below:
#include <assert.h>
void play(char c,int p) {
// Precondition
assert((c=='X') || (c=='O'));
assert((cells[p]==' '));
assert((p>=0) && (p<DIM*DIM));
if(cells[p]==' ') cells[p] = c;
// Postcondition
assert(cells[p]==c);
}
void main() {
init();
play('A',1);
}