In modern languages like Java, C# etc., there is a provision of function to handle String to Integer and Integer to String conversion. But in case of C, you should explicitly convert.
String to Integer ConversionString is a array of characters. So changing each character successively into integer changes whole string into integer. To change a character into an integer, here is a simple idea. The idea is, subtract the zero character from the character you want to change. For example to change character 1 into integer 1 subtract character 0 from character one i.e. ‘1’ - ‘0’ results integer 1. A portion of a C code is given below:
تعليقات: 0
إرسال تعليق