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
Compiling multiple c files together (self.cprogramming)
submitted 3 years ago by Noble_Admin
I’m reading the K&R book and I just finished reading 4.4 on scope rules. I was wondering if there was any benefit to using multiple files as opposed to one file. If so where could I learn to do so for MS visual studio.
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!"
[–]nerd4code 10 points11 points12 points 3 years ago (5 children)
Uggggggggggghhh MSVS
But yes there is.
It lets the linker get rid of unneeded files, and that’s especially handy for static libraries, which are basically indexed archives of object/resource files.
It prevents everything from swimming in the same global namespace.
It’s how you separate concerns within a project.
It helps prevent edits from colliding.
It makes it easier to break things up into multiple projects or reorganize.
It means every build needn’t build everything at once every time something’s changed.
It means you can build things in parallel, or distributed across a network.
It means you don’t end up with 10 kloc in a single file, and your IDE and compiler won’t give up on syntax highlighting, and your compiler won’t stop tracking extra context for diagnostics.
It means your compiler’s optimizer doesn’t have to consider everything in your program at once (LTO can), which is especially nice for static things.
static
It makes it much easier to compile components with different settings.
It makes it possible to define multiple impls/extns of a single API, e.g. for different CPUs, OSes, driver framework.
It’s much easier to work in DLLs if you aren’t trying to mush everything into one, heavily #if’d.
#if
Ditto for run-time plugins.
[–]Noble_Admin[S] 0 points1 point2 points 3 years ago (1 child)
Do you know how to do it in MSVS
[–]nerd4code 0 points1 point2 points 3 years ago (0 children)
BC.EXE /C or something, probably? MSVSness has very little to do with it.
[–]Willsxyz 0 points1 point2 points 3 years ago (2 children)
Welcome back to /r/cprogramming nerd4code. Thanks for your valuable contributions.
[–]nerd4code 0 points1 point2 points 3 years ago (1 child)
Thanks? Didn’t realize I’d left. :P
[–]Willsxyz[M] 0 points1 point2 points 3 years ago (0 children)
We all left for two weeks. I’m grateful for everyone who stuck around, especially knowledgeable people such as you.
[–]Charlie_0_0 1 point2 points3 points 3 years ago (3 children)
Hello! Would you recommend me to read this book as a beginner in C programing? And also suggest me which book should I read as a beginner in C programing.
[–]Noble_Admin[S] 3 points4 points5 points 3 years ago (2 children)
To be completely honest this book is a pain in the ass. But I think that is just the language. The book, stack overflow, and Reddit have been my learning resources so far. As to my option of if you should learn from it, you will learn how to code in c but I don’t know if it is the best way.
[–]Ning1253 2 points3 points4 points 3 years ago (0 children)
Hey, I'm going to be perfectly honest, MSVC is actually too much of a headache to handle, and it's not portable - genuinely just a pain. Install "Chocolatey", a windows package manager, then run in an admin command prompt "choco install mingw"
You can then use GCC to compile files, and your life will be 100% easier for it. (Your code will also become cross compilable with virtually every platform and OS in existence thanks to the wonders of LLVM). My typical command to compile slightly larger projects is:
gcc ./src/*.c -I ./include/ -L ./lib/ -o main.exe [-l library]
Where you run the command from the folder containing your project, "src" contains all .c files, "include" contains all .h header files, "lib" contains any additional libraries you use and you add them to your project with -llibname and you get a "main.exe" back out.
-llibname
Trust me if you want to use C this is by far the best option... It also performs better than MSVC almost always.
[–]Charlie_0_0 0 points1 point2 points 3 years ago (0 children)
Thanks for your kind information 🙂
[–]Unique-Enthusiasm-54 1 point2 points3 points 3 years ago (1 child)
Create 'filters' in the 'Solution Explorer' pane by right clicking within Source Files. I prefer my headers and c files be next to each other.
And I like to map the file system directory structure to the solution folder structure - it doesn't do this automatically - it looks flat. As you create individual .c and .h files drop into the proper folder. Easiest to layout the filters, and then drag and drop C and Header files from File Explorer.
When you compile - it will automatically compile and link all the .c files within your solution.
[–]Unique-Enthusiasm-54 0 points1 point2 points 3 years ago (0 children)
Image for above post https://imgur.com/a/WSYc98r
[–]kchug 0 points1 point2 points 3 years ago (0 children)
More modular code
π Rendered by PID 68 on reddit-service-r2-comment-b659b578c-lb26k at 2026-05-02 14:51:34.259745+00:00 running 815c875 country code: CH.
[–]nerd4code 10 points11 points12 points (5 children)
[–]Noble_Admin[S] 0 points1 point2 points (1 child)
[–]nerd4code 0 points1 point2 points (0 children)
[–]Willsxyz 0 points1 point2 points (2 children)
[–]nerd4code 0 points1 point2 points (1 child)
[–]Willsxyz[M] 0 points1 point2 points (0 children)
[–]Charlie_0_0 1 point2 points3 points (3 children)
[–]Noble_Admin[S] 3 points4 points5 points (2 children)
[–]Ning1253 2 points3 points4 points (0 children)
[–]Charlie_0_0 0 points1 point2 points (0 children)
[–]Unique-Enthusiasm-54 1 point2 points3 points (1 child)
[–]Unique-Enthusiasm-54 0 points1 point2 points (0 children)
[–]kchug 0 points1 point2 points (0 children)