When the c program needs to get input from the user, we should use scanf function.
To get input from the user, we should instruct the scanf function the following details,
Specify the format i.e. which data type we are going to get from the user.
Give the variable address where we want to store the value.
To know about format specifiers kindly follow the below link,Format specifiers in C
How to get the address of a variable ?
Using ampersand (&) operator, we can get the address of a variable. In C, we will refer & as address of operator.
In scanf, we must give the address of a variable not
Printing address of a variable
%x is used to print the address in hexadecimal format.
This program will get values from the user and print it.
Correct the below program
The below program has some syntax errors.
Correct the program by yourself and see the output.