C Language Tutorials by Ghulam Murtaza Dahar - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

Output

Enter character: g

You entered g.

Conversion format string "%c" is used in case of characters.

ASCII code

When character is typed in the above program, the character itself is not recorded a numeric value(ASCII value) is stored. And when we displayed that value by using "%c", that character is displayed.

#include <stdio.h>

int main(){

char var1;

printf("Enter character: ");

scanf("%c",&var1);

printf("You entered %c.\n",var1);

/* \n prints the next line(performs work of enter). */

printf("ASCII value of %d",var1);

return 0;

}

Find Your Next Great Read

Describe what you're looking for in as much detail as you'd like.
Our AI reads your request and finds the best matching books for you.

Showing results for ""

Popular searches:

Romance Mystery & Thriller Self-Help Sci-Fi Business