252 views
0 votes
0 votes
printf("The ASCII value of %c = %d\n",i,i);   what is the meaning of this line  why i,i written in the code.

1 Answer

2 votes
2 votes

It means that whatever value is stored in i (as binary in the memory) , print the value after converting it to character by using %c conversion specifier and then again print the value after converting it to integer by using %d conversion specifier.

 

A conversion specifier begins with a percent sign, and ends with one of the following output conversion characters. The most basic conversion specifiers simply use a percent sign and one of these characters, such as %d to print an integer. (Note that characters in the template string that are not part of a conversion specifier are printed as-is.)

http://www.crasseux.com/books/ctutorial/Formatted-output-conversion-specifiers.html

Related questions

0 votes
0 votes
1 answer
1
Desert_Warrior asked May 16, 2016
4,153 views
#include<stdio.h int main() { int a[10][20][30] = {0}; a[5] = 2; return 0; }(a) printf("%d",*(((a+5)+2)+1));(b) printf("%d", *((a+5)+2)+1);(c) printf("%d",*(*(*(a+5)+2)...
1 votes
1 votes
1 answer
4
Rohit Gupta 8 asked Nov 8, 2017
465 views
What does the following fragment of C- program print?char t[] = "PROGRAM1234"; char *r = t; printf ("%s", r + r[6]- r[3]);Explain.