Character
handling and
string conversion
functions
Ms. Mamoona Tasadduq
Credits: Yuksel / Demirer
,Outline
• Background: The conditional operator ?:
– An alternate of simple if-else statement
• Character handling library functions
– Boolean functions of format is<charType>(int)
– Examples
• String format conversion library functions
– Converting from string to numbers
• Formatted read/write in string variables
– The sscanf and sprintf functions
9-2
, Conditional Operator
• The only ternary operator in C, i.e. operator with
3 operands.
– An alternate of simple if-else statement
• General format:
– CONDITION ? True_Result : False_Result
• The result of above conditional operator is:
– True_Result, if the CONDITION is ture,
– False_Result, if the CONDITION is False.
9-3