Input binary variables in C
1
Name:
Anonymous
2009-06-16 9:42
how can i input binary variables in C?
like: int c=b01010101
2
Name:
Anonymous
2009-06-16 9:45
all variables are stored in binary.
3
Name:
Anonymous
2009-06-16 9:45
Convert them to decimal or hexadecimal.
4
Name:
Anonymous
2009-06-16 9:46
You can't do that. Read the C FAQ.
5
Name:
Anonymous
2009-06-16 9:48
The C compiler from Micrchip for PICs allows you to enter binary numbers. Computer programmers are more advanced. They use base16 .
6
Name:
Anonymous
2009-06-16 9:52
write a perl script
7
Name:
Anonymous
2009-06-16 10:31
unsigned int lol(char *s) {
int r=0,m=strlen(s)-1;
for(;*s;m--)
if(*s++-48)
r+=1<<m;
return r;
}
8
Name:
Anonymous
2009-06-16 12:36
>>7
Can't this be done in the preprocessor to eliminate runtime overhead?
Better question: does any compiler precalculate static functions called with compile-time known values? I know some of them do it for some specific functions (mostly math stuff), but I wonder if it's more spread.
9
Name:
Anonymous
2009-06-16 13:14
GNU C implements an (ex.) 0b11101101 extension if you're not looking to abide by any sort of standards.
10
Name:
Anonymous
2009-06-16 13:24
>>9
But
GNU is the
standard !
11
Name:
Anonymous
2009-06-16 18:23
>>8
run time overhead...??? you can just run it once at the start and cache it ...
12
Name:
Anonymous
2009-06-16 18:52
>>8
Don't write proper/on topic replies AND saging
13
Name:
Anonymous
2009-06-16 21:44
>>10
Despite the fact that your post was humerus and amusing, it actually had some valid
content so it's EXTREMBLY RUDE OF YOU TO SAGE HOW DARE YOU
14
Name:
Anonymous
2009-06-17 1:48
15
Name:
Trollbot9000
2009-07-01 9:16
Values used as keys?
Newer Posts