if we print a float using %d garbage value is printed....but if we scan a float value using %d & int...the value gets truncated...What is the reason behind it...
manishanibhwani 0 Newbie Poster
Recommended Answers
Jump to PostWhat is the reason behind it...
If you lie to printf(), you get what you deserve. When you tell printf() to expect an int, it treats whatever you pass like an int. When you tell printf() to expect a float, it treats whatever you pass like a float. …
Jump to Postthen why does scanf returns 1 in following case if we give a floating point variable as input..
Because scanf() reads until the first invalid character, and if there were valid characters before that such that a conversion can be performed the the conversion will succeed. The first …
All 6 Replies
Sokurenko 42 Junior Poster

I_m_rude
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
manishanibhwani 0 Newbie Poster
Sokurenko 42 Junior Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.