Lesson 2 of 23
Variables, Format Specifiers
9 min 20 XP
C-യിൽ ആദ്യം variable-ന്റെ type declare ചെയ്യുന്നു: int (പൂർണ്ണസംഖ്യ), float/double (ദശാംശം), char (ഒരു അക്ഷരം). Values print ചെയ്യാൻ printf format specifiers ഉപയോഗിക്കുന്നു: int-ന് %d, double-ന് %f, char-ന് %c.
Example: edit me and press Run
Output Loading C (first time takes a few seconds)
Press Run to see the result here.%.2f രണ്ട് ദശാംശസ്ഥാനങ്ങളോടെ print ചെയ്യുന്നു. sizeof() ഒരു type എത്ര bytes ഉപയോഗിക്കുന്നുവെന്ന് പറയുന്നു. const variable മാറ്റാനാവില്ല.
Example: edit me and press Run
Output Loading C (first time takes a few seconds)
Press Run to see the result here.തെറ്റായ specifier (int-ന് %f പോലെ) ഉപയോഗിച്ചാൽ ചവറ് print ആകും. Interviewers ശരിക്കും format specifiers-നെക്കുറിച്ച് ചോദിക്കാറുണ്ട്!