Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

why don't we use & in printf??

0 votes
asked Jul 8, 2019 by manishareddy (130 points)

2 Answers

0 votes
answered Jul 10, 2019 by ramesh 1 flag

printf() is the reverse function of scanf(). It prints the formatted string to the standard output.

commented Jul 12, 2019 by Loki (1,600 points)
This is really not the answer bro.
+1 vote
answered Jul 12, 2019 by Loki (1,600 points)
edited Jul 12, 2019 by Loki
To understand this you must know about variables that are local to a block and passing values with reference to a function. When you pass variables to a function (unless it is an array) a change won't be reflected to the variable's value if you don't use the &(ampersand called the address operator) this ensures that the value of the variable you passed will change, we need to change the value when reading input thus in scanf() we use & with variable but in printf() we only need to read those values and not change them thus we don't need to use the & operator. Simply put if you used '&', it would think you want to show the address of the variable used as & is the address operator.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...