Someone ask me “What print(“%d”,nr); means ? And somewhere I saw exactly the same sequence but with printf. Can you enlighten me ?”
Surely, I can explain you. Let’s take step by step.
printf – the function for display “nr” ON SCREEN
%d – a integer variable
nr – the variable which will display ON SCREEN
; – at the end of each instruction you must ;
You saw that I laid emphasis on the fact that displays on-screen. Why ? Because the function printf (not print) is the same function, but printf will display the variable “nr” in a file.
The program run and display the value must display only if you declared correctly.
1) At beginning of the program you must declared the variable like this :
2) The variable’s value must be read or you must attribute a value at the variable
nr=33; (33 is only an example)
Don’t forget ! ! ! At reading you must put & , but when you display the variable you don’t must put this. If you don’t make like this, the program will return an error.