I am relatively new to programing (I just got a book on C, and am trying to teach myself for fun), and I wrote a relatively complicated program (for me) that took in a date (in numerical form) and spat out the day of the week (the code is attached). When I was testing the code for bugs some really weird things started happening. It appeared that a variable was mysteriously changing its value from Month[12]=31 to Month[12]=10. I know these sort of things can happen from careless programming, so I tested what was going on. I inserted a
printf("%d %d %d",Month[12],month,Month[month]);
and I discovered a logical impossibility. The output from that printf() statement was this: 31 12 10. Now, this is absolutely impossible. If month=12 and Month[12]=31, then Month[month] HAS to equal 31.
I thought maybe it was a problem with xcode's 'simulator', for lack of knowing what it is actually called. So I tried to open the 'Unix Executable File' but it didn't exist. Where in most XCode project folders exists the executable file, was a file that looked like an executable file, until I clicked on it. Upon which it would turn into a C source code file, that when opened, looked like bunch of gibberish (lots of upside down question marks and such symbols, interspersed with bits of the original code for my program). After restarting (which obviously didn't help) I got so frustrated I just threw away the entire 'Developer' folder from the applications folder.
I had saved my code as a text file and I copied it to my brothers laptop. There, I started a new Xcode project on his computer and LO! The program ran beautifully without a hitch. Good, I thought, so my code was all right. I then took the executable file created on my bro's computer and copied it onto mine. When I ran this executable file (which ran fine on my bro's comp) it exhibited the same symptoms that my original test revealed to be a logical impossibility! In other words, it seems to run ok, but you get whacky feedback. What the heck is going on? I haven't re-installed Xcode yet, but I don't expect different results, because the executable file that ran fine on my brothers computer exhibited strange mistakes on mine.
Some probably relevant information: I have a
mini with a 1.5ghz intel coresolo, that only had 2 GB free out of 60 (before deleting the Developer file). And my brother has a powebook G4 with a 1ghz PPC processor with ~10GB free out of 60. Both computers are running latest 10.5.
Thanks in advance for any answers.
printf("%d %d %d",Month[12],month,Month[month]);
and I discovered a logical impossibility. The output from that printf() statement was this: 31 12 10. Now, this is absolutely impossible. If month=12 and Month[12]=31, then Month[month] HAS to equal 31.
I thought maybe it was a problem with xcode's 'simulator', for lack of knowing what it is actually called. So I tried to open the 'Unix Executable File' but it didn't exist. Where in most XCode project folders exists the executable file, was a file that looked like an executable file, until I clicked on it. Upon which it would turn into a C source code file, that when opened, looked like bunch of gibberish (lots of upside down question marks and such symbols, interspersed with bits of the original code for my program). After restarting (which obviously didn't help) I got so frustrated I just threw away the entire 'Developer' folder from the applications folder.
I had saved my code as a text file and I copied it to my brothers laptop. There, I started a new Xcode project on his computer and LO! The program ran beautifully without a hitch. Good, I thought, so my code was all right. I then took the executable file created on my bro's computer and copied it onto mine. When I ran this executable file (which ran fine on my bro's comp) it exhibited the same symptoms that my original test revealed to be a logical impossibility! In other words, it seems to run ok, but you get whacky feedback. What the heck is going on? I haven't re-installed Xcode yet, but I don't expect different results, because the executable file that ran fine on my brothers computer exhibited strange mistakes on mine.
Some probably relevant information: I have a

Thanks in advance for any answers.