Funciones chr y ord en C created by parzibyte - https://repl.it/@parzibyte/Funciones-chr-y-ord-en-C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Equivalentes a ord y chr en C | |
@author parzibyte | |
*/ | |
#include <stdio.h> | |
int ord(char c); | |
char chr(int n); | |
int main(void) { | |
int valorDeArroba = 64; | |
char letraA = 'A'; | |
printf("El valor que tiene %d es %c\n", valorDeArroba, chr(valorDeArroba)); | |
printf("El valor numérico que tiene la letra %c es %d\n", letraA, | |
ord(letraA)); | |
return 0; | |
} | |
int ord(char c) { return (int)c; } | |
char chr(int n) { return (char)n; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment