Ask your own question, for FREE!
Computer Science 6 Online
OpenStudy (anonymous):

I'm using multiple scanfs in my code (for C) and storing the user's input to several variables. The only way for the scanfs to work is if I use fflush before using scanf. My question is when I use fflush, will the previous variables that used scanf be deleted?( i.e. if I ask for the user's input with scanf and store it as var1, and then use fflush and another scanf to get var2, will var1 be deleted or will it still be saved?)

OpenStudy (espex):

Once you have assigned the value to a variable, flushing the stream will not have an effect on the variable. Although it is interesting (and wrong) for you to be having this problem.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!