+ 2
Char array index output in C
When I tend to output the char array indices i.e char_array[0] and char_array[1] with the help of printf() function. You can see that code below. I use two type of format specifier (%c and %d) in printf() function for each char_array indices separately . Output comes from %c specifier gives a expected output But I won't understand the output comes from %d format specifier And I also confuse how does char_array index support %d format specifier https://code.sololearn.com/c1d6N74Zf0rm/?ref=app
3 Respostas
+ 4
Thank you Abhay ,Adnan Chowdhury and codemonkey.
I ask these types of questions frequently because i am new to C programming
Anyway thank you Friends :)
+ 1
Yup that works as expected ,it actually print a character output for %c as you mentioned ,and ASCII value for that character using %d
+ 1
Because the ASCII value of e=101 and h=104. When you print in decimal of e and h it prints the ASCII value of e and h.