I'm trying to write a shell program that, given an argument, prints the name of the program and every odd word in the argument (that is, not even words). However, I am not getting the expected result. Upon tracing my program, I notice that, despite modulus returning values of 1 on odd words (say, the 5th word, 5 % 2 = 1), the program still treats the result as 0 (an even word) and doesn't print the word. What might be going wrong here?
Included here is my code and the traced output to see exactly what I am getting. (Sorry for not including the code as text, I'm new to vim and don't know copy/paste yet)