HOW TO GET AN INPUT FROM USER

Here, we use scanf keyword to get an input value from user.
           /*  C program to take the name of the user as input and print "Hello <user name>" on console. */
          // include header file using pre-processor(pp:)
         
           #include<stdio.h>
           // main function with int return type
           int main()
           {
                // variable to store user name 
                // 26 here denotes this variable can store 26 characters
                char user_name[26];
                // get username form user as input
                printf("Enter your name \n");
                scanf("%s", user_name);
                printf("Hello %s", user_name);
                // terminate code using return keyword
                // return is not required when main function return type is void
                return 0;
            }
                OUTPUT → Enter your name

                                     Abi

                                     Hello Abi (final output displayed)

BRIEF EXPLAINATION 


The above example is a simple C program that takes the user name as input and displays their name on the console. Here user_name is used as a variable that can hold 26 characters in its value. Note that we have not defined what functions like printf() and scanf() do but, their definitions are included in header file stdio.h.