Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Last active December 11, 2018 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/9c2332bf876f464ec9a3f81a7909a72b to your computer and use it in GitHub Desktop.
Save parzibyte/9c2332bf876f464ec9a3f81a7909a72b to your computer and use it in GitHub Desktop.
Funciones chr y ord en C created by parzibyte - https://repl.it/@parzibyte/Funciones-chr-y-ord-en-C
/*
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