c - #define and then printf not working -


for assignment must define variable n 100, recall variable in printf statement. code looks :

#include <stdio.h> #include <stdlib.h> #include <limits.h> #include <time.h> #define n 100  int main ( ) { ... printf("try guess number between 1 , n \n\n") ; ... } 

the n coming out n rather 100.

this because between double quotes considered character array, i.e. string. if want show n in string, shall use "usual" variable:

printf("try guess number between 1 , %d \n\n", n) ; 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -