Created
November 23, 2016 11:09
-
-
Save splitline/3fd3bf601963b8841ea18e1e993ef3f5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#include <stdio.h> | |
long long int get_from_addr(long long int* p){ | |
return *p; | |
} | |
char* itobs(long long int n, char *ps) { | |
int size = 8 * sizeof(n); | |
int i = size -1; | |
while(i+1) { | |
ps[i--] = (1 & n) + '0'; | |
n >>= 1; | |
} | |
ps[size] = '\0'; | |
return ps; | |
} | |
int main(){ | |
double in; | |
while(~scanf("%lf",&in)){ | |
double *p=∈ | |
long long int n=get_from_addr((long long int *)p); | |
char s[8 * sizeof(n) + 1]; | |
printf("%s\n",itobs(n,s)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment