4 ms·
This reminded me of the very first _big program_ I wrote in C. My cousin showed me steps to solve a magic square [0] and asked me to write the program. I did
by girishso 5y ago
This reminded me of the very first _big program_ I wrote in C. My cousin showed me steps to solve a magic square [0] and asked me to write the program.
I did not have a computer at the time. So I wrote actual program on paper, ran it, debugged it mentally. When I was satisfied, next day I went to my father's office which had a computer luckily with C compiler. I typed the whole program from the paper and ran it. There was no compiler errors or anything, but it didn't print anything on screen, absolutely nothing. I was surprised because I knew it can't fail. After spending hours of checking program and reading books (internet was still a long away), I realized I had put semicolons after every single statement including `if`s and `for`s conditions, essentially short circuiting everything. Once I got rid of those extra semicolons, it ran perfectly. What a nostalgia!
[0] https://en.wikipedia.org/wiki/Magic_square https://en.wikipedia.org/wiki/Magic_square