Understanding the code
Let's understand the code line by line.
printf("\n\n\t\tStudytonight - Best place to learn\n\n\n");
This line is used to print a header on the console.
char c;
This line declares a variable c
of type character.
printf("Enter a character: ");
This line prints a message asking the user to input a character.
scanf("%c", &c);
This line reads the input character from the user and stores it in the variable c
.
printf("\n\nASCII value of %c = %d", c, c);
This line prints the ASCII value of the input character that was read in the previous line. The %c
format specifier is used to print the character and %d
format specifier is used to print the corresponding ASCII value.
printf("\n\n\t\t\tCoding is Fun !\n\n\n");
This line is used to print a footer on the console.
return 0;
This line indicates that the program has finished executing and returns 0 as the exit status.