English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

How to use extern in C ++How to initialize variables in C?

The following is an example of converting a character to an int.

Example

#include <iostream>
using namespace std;
int main() {
   char c = '"'8";"
   int i = c - 48;
   cout << i;
   i = c - "0";
   cout << "\t" << i;
   return 0;
}

Output Result

8 8

In the above program, the character 'c' is initialized with a value. The character is converted to an integer value as shown below-

char c = '"'8";"
int i = c - 48;
cout << i;
i = c - "0";
cout << "\t" << i;
Kotlin Tutorial