C Language standards and references where to find?

I apologize if this is a dumb question.

I have googled this and what I find is not really what I am after. The only thing that was exactly what I wanted is the actual current ANSI Standard for C document which at $260 is a bit much right now.

I like my reference tables and charts and I would love to have good ones available for C.

The ones I have found are very word heavy. I already have the C language book explaining everything I just everything in handy lists for reference.

1 Like

Cheat sheets is the better description of what I am looking for.

Something like this?

Also, if you use Linux, standard C functions all have a man page. Just type man printf for instance (sometimes you need to do man 3 <function> though).

3 Likes

Great Link! That is a really nice reference sheet. I like that. Thanks.

2 Likes

To your slightly unrelated question about the C standard, yes, each revision is paywalled, as is the C++ standard given ISO standards are like that, but that really only applies for the final version. If you aren’t implementing a C compiler for a job and only need to use it for referencing behavior and etc. in general, you can get by with the draft standards that are published in the open and get the ones right before the document is frozen and ratified to become the standard. So for instance, with C17, the latest revision that bugfixes C11, you can get pretty much a complete draft here before the standard ratified. And then for after the standard ratified, you can find a newer version here which is the version the ISO WG14 recommends here for that version in draft. This will suffice unless you are asking about a new feature or bugfix that made it into that standard or you need to do this for a job in which case, the employer should be paying that fee. And if you only care about C89/99/11, there are copies floating out there which ISO doesn’t care about that much anymore you can find online.

1 Like

That’s great. I am just trying to learn the language and I just like to be able to look things up. Doesn’t have to be the latest revisions.

You won’t really need the standard as a beginner, it will help when StackOverflow answers contain it for some very technical explanations on why things are the way they are and you can reference something mentioned there which would be the only use it would serve for you at this stage, I would think. A good chunk of the standard also isn’t that technical or jargon-heavy so it should make sense when you read something what the standard wants or interprets.
But again, it’s mostly for people who make the tools like compilers that have to follow it to the letter to make things work correctly and be standards compliant. It is still useful though and I did wish I had actually known that and had something like that more on hand when I was learning the language a decade ago when information was still missing parts and pieces here and there outside of *nix and BSD environments and trying to do C programming on Windows was painful being the idiot I was not wanting to switch. Clang being made available on Windows made life a lot easier but it was not ready until I was about to graduate.

I don’t know why more and more people don’t embrace cheat sheets in their life. Brains are not big enough to remember absolutely everything. Sometime you just need to be reminded that or in C is ||.

logical yes, bitwise is | lmao

1 Like

That is something I am learning about coding is that some of the character choices don’t make a lot of sense.

Well, a lot of the confusing choices made sense in the 70s when the language was first popularized. Most programmers back then also dabbled in electronics engineering.

Personally I feel things like || and && should be phased out in favor of or and and - the parsing cost is negligible and would un-confuse a lot of new people. Of course, this means or and and needs to become reserved keywords.

The 3 most important things to know about C:

  1. There are two types of variables. Integers, and PointersÂą.
  2. In C, everything is a block of memory and can be recast to any integer or pointer type. This means memory leaks will be a common occurence.
  3. To solve a problem, you write more C code.

Âą There are technically floating points, but they should only be used when given no other choice and is a constant source of bugs. Stay as far away as possible, and try using 32- or 64 bit fixed point instead.

What I am realizing from learning C via Brian Kernighan and Dennis Ritchie’s book is that I need to go back and learn FORTRAN because they quote that a lot. I am not looking forward to C++ because that book is like 2 inches thick compared to 1/2 an inch for the c book.

So if your original question was having the ISO. Ive got each year stashed on discord

Heres the thing.

LEARN C99 FIRST, When your good at C99 the rest comes easy. Plus your programs will generally be compatible with every system out there. Where as expecting everything to be read for C23 or C11 (best one theres ever been) can sometimes be a pain. I havent encountered it but C99 is where it all was really perfect imho

Heres the ISO

Heres the gnu c ref manual

The c ref car was above linked but its a good quick ref

Its a good learning experience but its very very outdated.

I dont want to discourage it but I also wouldn’t want to recommend the old habit.

Programming is there to solve a problem. You solve the problem. Then you make the solution good. Then you worry about optimizing it

Those are great thanks!

Also if your planning to do this on linux. You can always dive into the rabbit hole of musl vs glibc. Personally I love musl but everyone and their kitchen sink uses glibc for c lib references and locales

https://www.etalabs.net/compare_libcs.html

For now I am just doing it in Windows. But I do want to get another ssd at some point soon and either build a really cheap second PC or stick it in my windows workstation and have linux on that. I feel if I am going to have an opinion on something I should probably learn it properly.

Well, you could go that way, but the Kernighan & Ritchie book will give you a lot of advice that was good for it’s time but is now considered outdated. I would start with something like Modern C and use Kernighan & Ritchie as a complementary reference.

1 Like

Personally I dont learn from books. I set out to solve an issue or create a program. I keep the reference on hand and I just go ahead and make it.

Its the fastest way

Also you dont need to install linux on an ssd. Just use wsl2 and pull arch linux from the wsl repos and run and make stuff in there. You can have neovim in there too and boom you got your IDE

I am actually finding the book really good. I will check out the modern c book as well.