Lesson 4 of 23
Operators மற்றும் Type CastingOperators and Type Casting
9 min 20 XP
இரண்டு int-களை வகுத்தால் (/) தசமப் பகுதி நீக்கப்படும்: 7 / 2 = 3. % மீதியைத் தரும்: 7 % 2 = 1. தசம விடை வேண்டுமெனில் (double) என்று cast செய்யுங்கள்.
Dividing two ints drops the decimal part: 7 / 2 is 3. % gives the remainder: 7 % 2 is 1. Cast with (double) when you need a decimal answer.
Example: edit me and press Run
Press Run to see the result here.++i முதலில் கூட்டி பிறகு மதிப்பைத் தரும்; i++ முதலில் பழைய மதிப்பைத் தந்து பிறகு கூட்டும். இது C interview-களில் மிகப் பிரபலமான கேள்வி.
++i increments first and then gives the value; i++ gives the old value and then increments. A very popular C interview question.