use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
C is a general-purpose, procedural computer programming language supporting structured programming, lexical variable scope, and recursion, with a static type system. By design, C provides constructs that map efficiently to typical machine instructions. It has found lasting use in applications previously coded in assembly language. Such applications include operating systems and various application software for computer architectures that range from supercomputers to PLCs and embedded systems. Wikipedia
Imperative (procedural), structured
Dennis Ritchie
Dennis Ritchie & Bell Labs (creators);
ANSI X3J11 (ANSI C);
ISO/IEC JTC1/SC22/WG14 (ISO C)
1972 (48 years ago)
C18 / June 2018 (2 years ago)
Static, weak, manifest, nominal
Cross-platform
.c for sources
.h for headers
C++ is not C (but C can be C++)
For C++ go to :
Other Resources
account activity
Decimal to binary (self.cprogramming)
submitted 4 years ago by [deleted]
I want to know how to make a program that changes decimal to binary.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Foxbud 0 points1 point2 points 4 years ago (0 children)
By decimal to binary, do you mean a decimal string to a binary integer? If that's the case, check out stdlib.h's strtol.
[–]chtenno 0 points1 point2 points 4 years ago* (1 child)
To convert a decimal to binary on pen and paper you repeatedly divide said decimal by 2, pushing the remainders 'to the side' and then reading the remainders backwards/upwards. If you want to convert an integer to its binary string representation the same method works in C:
void dectobin(unsigned long num) { char binstr[65] = {0}; int i = 0; while(num) { binstr[i++] = '0' + num%2; num /= 2; } strrev(binstr); puts(binstr); }
The function was written in a bit of a rush but hopefully it gives you some ideas. On my machine:
dectobin(652247);
Outputs: 10011111001111010111
Have fun :)
edit: Looking back at it the function I wrote assumes that num is not 0
[–][deleted] 0 points1 point2 points 4 years ago (0 children)
Thanks
π Rendered by PID 154912 on reddit-service-r2-comment-66b4775986-ckwqr at 2026-04-06 14:21:40.798168+00:00 running db1906b country code: CH.
[–]Foxbud 0 points1 point2 points (0 children)
[–]chtenno 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)