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. Divyanshum29 asked Jul 16, 2018 Divyanshum29 252 views answer comment Share Follow See 1 comment See all 1 1 comment reply Kamal Pratap commented Jul 16, 2018 i edited by Kamal Pratap Jul 17, 2018 reply Follow Share %c = when you want to print the character %d = when you want to print the integer int main() { char example='a'; printf("%d",example); //output = 97 (ASCII value of 'a') printf("%c",example); //output = a (character having ASCII value of 97) return 0; } in your statement printf("The ASCII value of %c = %d\n",i,i); %c = character which is assigned to ' i ' variable %d = value/integer of 'i' variable( in this case ASCII value of variable ' i ' ) ) 1 votes 1 votes Please log in or register to add a comment.
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 Aakash_ answered Jul 16, 2018 Aakash_ comment Share Follow See all 0 reply Please log in or register to add a comment.