compilation - C Error: comparison between pointer and integer [enabled by default] -


i trying learn basic c code, bolster general skills. wrote basic script tells me if number greater or less 10:

#include <stdio.h> #include <unistd.h> #include <string.h>   int main() {    int number;     printf("enter integer\n");     scanf("%d",&number);     printf("integer entered %d\n", number);     if ( "%d" > 10)       printf("%d greater 10.\n", number);    else       printf("%d less 10.\n", number);     return 0; } 

and yet when compile it, error stating i'm trying compare pointer , integer:

dave@dave-[laptop]:~/code/c/examples$ gcc 004----takeandif.c -o 004----takeandif 004----takeandif.c: in function ‘main’: 004----takeandif.c:16:14: warning: comparison between pointer , integer [enabled default]     if ( "%d" > 10)               ^ 

and when run it, says numbers less 10:

dave@dave-[laptop]:~/code/c/examples$ ./004----takeandif enter integer 2 integer entered 2 2 greater 10. 

none of other answers apply situation. should change?

replace

if ( "%d" > 10) 

with

if( number > 10 ) 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -