0
All arguments in C are passed by value. That's why you need to pass a pointer(using '&') if you want a function(scanf) to be able to change a variable. Hope this helps
27th Apr 2021, 6:45 PM
Mihail
Mihail - avatar
0
& with variable returns address of variable. Scanf function use that address to store data in it.
27th Apr 2021, 9:40 PM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar
0
Prince The reason is, scanf() needs to modify values of a and b and but they are local to scanf(). So in order to reflect changes in the variable a and b of the main function, we need to pass addresses of them. We cannot simply pass them by value. https://www.geeksforgeeks.org/use-scanf-not-printf/
27th Apr 2021, 10:20 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar