[c] printf a variable in C

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x = 1;

    printf("please make a selection with your keyboard\n");
    sleep(1);
    printf("1.\n");

    char input;
    scanf ("%c", &input);
    switch (input) {
        case '1':
            x=x+1;
            printf(x);
    }

    return(0);
}

I am trying a make a variable add to itself and then print that variable out but I can't seem to get my code to work.

my output error is

newcode1.c: In function ‘main’:
newcode1.c:20:2: warning: passing argument 1 of ‘printf’ makes pointer from integer without a cast [enabled by default]
In file included from newcode1.c:1:0:
/usr/include/stdio.h:362:12: note: expected ‘const char * __restrict__’ but argument is of type ‘int’
newcode1.c:20:2: warning: format not a string literal and no format arguments [-Wformat-security]

This question is related to c variables

The answer is


As Shafik already wrote you need to use the right format because scanf gets you a char. Don't hesitate to look here if u aren't sure about the usage: http://www.cplusplus.com/reference/cstdio/printf/

Hint: It's faster/nicer to write x=x+1; the shorter way: x++;

Sorry for answering what's answered just wanted to give him the link - the site was really useful to me all the time dealing with C.