c - How does conversion specifier work? -


can check understanding of scanf?

int a; scanf("%d",&a); 

if input 13, conversion specifier convert 13 binary , stored in a?

if input 13.3, convert decimal fraction 13.3 binary , store in a?

i don't know knowledge in c, how data stores in c important , interesting topic. whenever data stores in variable in binary format, not possible see binary data in simple c language can see binary in embedded c. pass data in port or program providing data internally , sending output port connected led. suppose if passed -1 in port , port sending output led connected can see leds connected glow. in c can observe

char c=-1;  printf("%u",c);  

output=255 %u used unsigned integer not error can check it. int , char store in same fashion means if try store char think it's ascii value 65 stored in binary way.

char ch='a'; printf("%d",ch); output 65  

same

int i=65; printf("%c",i); 

output a; float stored different int has 3 different parts 1 sign bit, second mantissa , exponent. suppose

float f=5.55; if(f==5.55) pf("true"); else  pf("false"); output : false 

now again

float f=5.25; if(f==5.25) pf("true"); else  pf("false"); 

output : true it's data stores in memory important topic teacher not discuss in classes. hope use full you.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -