SCHOOL OF CODE BUILDERS
Learn To CODE. Become A DEVELOPER.
Pages
HOME
DATA STRUCTURES
STRINGS
ARRAYS
MATRIX
BINARY TREES
LINKED LIST
STACK
QUEUE
SORTING
SEARCHING
C
PYTHON
PSEUDOCODE
CONTEST PROBLEMS
ALGORITHMS
PATTERNS
PHP
C PUZZLES
C INTERVIEW QUESTIONS
JAVA
C++
HASHING
RECURSION
BASIC C PROGRAMS
TCS-CODEVITA
FACEBOOK
CONTACT US
C program to convert character to an integer
C program to convert character to an integer
#include
#include
int main(void) { /* initialize the character */ char ch='1'; int a; /* convert the character(1 byte) to integer(4 bytes) */ a=ch-'0'; /* print the ASCII value of character*/ printf("%d\n",ch); /* print the integer */ printf("%d\n",a); /* check the size of the character variable in bytes */ printf("ch=%d\n",sizeof(ch)); /* check the size of the converted integer variable in bytes using sizeof operator*/ printf("a=%d\n",sizeof(a)); return 0; }
PREVIOUS
NEXT
HOME