How to pass a character to printf that was input by user in C?

I am just starting with C and trying to grasp the whole idea of pointers and I just came across the following issue.

I am trying to print out a character that was input by the user passing it to a separate function:

#define TRUE 1
#define FALSE 0

// print a menu
void getCharacter() {   
    char getNum[MAX_OPTION_INPUT+2];
    int finished = FALSE;

    // get character from user
    do {
        fgets(getNum, MAX_OPTION_INPUT+2, stdin);
        if (getNum[strlen(getNum) - 1] != '\n') {
            printf("Input one digit number please.\n");
      else {
         getNum[strlen(getNum) - 1] = '\0';
         finished = TRUE;
   } while (!finished);


// process menu
void processChar(char num) {
    printf("TADA: %c", num);

When I compile this code I get a warning: passing argument 1 of 'processChar' makes integer from pointer without a cast

And when I run it it prints out some weird character instead of the one that I supposed to pass.

Could you please explain to me where I am missing the point here? Thanks in advance!


Change the function to accept a char *:

void processChar(const char *num)
    printf("TADA: %s", num); /* %s instead of %c */

Could you please explain to me where I am missing the point here?

You're passing and using num as if it's a character when it's actually a character array.

Need Your Help

Datatable does not update after rows removed

jsf primefaces datatable

i have a datatable using the primefaces library, and while i have got all the functions working i have just one small issue, when i press the command link to remove the row, it works and the row gets

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.