597 views
0 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 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

Position:
Show:

Related questions

0 0 votes
1 answers 1 answer
4.9k
4.9k views
Desert_Warrior asked May 16, 2016
4,879 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)...
6 6 votes
4 4 answers
343
343 views
GO Classes asked Jun 15
343 views
What is the output of the following code?#include <stdio.h void fun(int n) { if (n == 0) return; printf("%d ", n); fun(n - 1); printf("%d ", n); } int main() { fun(3); re...
3 3 votes
2 2 answers
188
188 views
GO Classes asked Jun 13
188 views
What is the output of the following code?#include <stdio.h void fun(int n) { if (n == 0) return; fun(n - 1); printf("%d ", n); } int main() { fun(4); return 0; }$\texttt{...
4 4 votes
2 2 answers
216
216 views
GO Classes asked Jun 13
216 views
What is the output of the following code?#include <stdio.h void fun(int n) { if (n == 0) return; printf("%d ", n); fun(n - 1); } int main() { fun(4); return 0; }$\texttt{...