Greetings, I'm working on this number guessing game which works, sort off...
after it get the guess, it's suppossed to check that number in the void test(int guess, int target) function. It seems that it's totally skipping this. I've been looking at this for a while and don't understand why. Does anyone see anything wrong with my call or maybe provide a link that describes the issue? thanks

#include <stdio.h>
#include <stdlib.h>
//Constant Definitions
#define TARGET 32

void test(int guess, int target);
//void check(int check);

int main()
{
      int a_guess;

      printf("I'm thinking a number.\n");
      printf("Try to guess what it is. ");

//      check;
      scanf( "d%", &a_guess);
     
 test;

      printf(" The number was %d.\n", TARGET);
      system("PAUSE");
      return 0;
}

 void test(int guess, int target)
{
     if(guess < target)
       printf( "Too low!\n");
     else if (guess > target)
       printf( "Too High!\n");
     else
       printf("You finaly got it!\n");
}

/* void check(int check)
{

 if(check > 5)
    printf(" You lose, too many tries\n");

}
*/

>scanf( "d%", &a_guess);
Format modifiers start with a % symbol. It should be "%d" instead of "d%".

>test;
Your test function takes two parameters, so you need to provide the arguments. Also, C doesn't allow the omission of parens even if a function takes no parameters:

test ( a_guess, TARGET );
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.