NO

Author Topic: use of debugger- Newbie question!  (Read 2231 times)

sircut

  • Guest
use of debugger- Newbie question!
« on: May 11, 2011, 09:05:53 PM »
Was a syntax error. Thanks for looking anyway!  ;D

Am taking classes in c programming , and have been assigned to write various "simple' c programs. I find that I am mostly unsuccessful at it. What works one time does not seem to work for next "simple" program.  What can i use to hepl. I copy word or symbol for word or symbol but have a 50 percent chance of success at best even if I START with good code! Here is the latest , code using "? :" to check for plural variable(s) and print -is or are -for correct grammar.
/*conditional test*/
#include <stdio.h>
int main ()
{   int num=7;
        ( num  %2  != 0 )  ?   printf("%d is oddf\n, num") :
        printf("%d is even\n", num );
   printf("there %s" ,  (num == 1)  ? " "is" : "are");
   printf("%d %s\n", num, (num ==1) ? "apple" : "apples" );
   num = 1
   printf("there %s", (num == 1) ? "is" : "are" );
   printf("%d %s\n", num, (num == 1 ) ? "apple" : "apples" );
   return 0}

When I run it I get numerous debugger syntax errors!
Well , I found it , was syntax errors in the writing of the code! Posted just for the heck of it , because I already wrote all this junk. :|)