What is the function of %x in this code? C language!😗 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 12

What is the function of %x in this code? C language!😗

#include <stdio.h> int main() { int i = 0; printf("The address of i is %x\n", &i); test(i); printf("The address of i is %x\n", &i); test(i); return 0; } void test(int k) { printf("The address of k is %x\n", &k); } my question is why this (%x) is not printed as text ?

24th Feb 2018, 3:57 AM
Jay Jay
Jay Jay - avatar
7 Answers
+ 19
It is the format specifier it tells in what format u want the value of k %x = hexadecimal format %d = decimal %f = float %c = character %s = string... etc...
24th Feb 2018, 8:35 AM
🌛DT🌜
🌛DT🌜 - avatar
+ 7
%x is a request to display the next argument in hexadecimal.
24th Feb 2018, 4:07 AM
John Wells
John Wells - avatar
+ 7
#### %x is a hexa decimal format. so this text is not printed.
25th Feb 2018, 9:10 AM
PON SELVA.J
+ 1
i guess its a function other than main,... keep doing courses u will learn
8th Mar 2018, 6:01 PM
Jay Jay
Jay Jay - avatar
0
it is a format specifier . It tells about the k value is in hexadecimal format. so it is not printed.
1st Mar 2018, 1:32 PM
B.Swetha
B.Swetha - avatar
0
ok thanx
8th Mar 2018, 6:20 PM
Said Mahi
Said Mahi - avatar
- 1
what is test() ?
8th Mar 2018, 5:48 PM
Said Mahi
Said Mahi - avatar