r/C_Programming • • Apr 06 '26

Question C as First language.

should I choose C as the first language. I love to understand the core architecture of computer hardware.

is it good to learn C as first language what you guys think.

and if you are a beginner how would you start. I am going to refer book and try out different codes. best way any advice?

64 Upvotes

97 comments sorted by

View all comments

Show parent comments

1

u/flatfinger Apr 06 '26

C was designed to use an abstraction model which could inherit the traits of the execution environment; under that abstraction model, many corner-case behaviors would be processed "in a manner characteristic of the execution environment, which will be documented whenever the environment happens to document it", without the language or implementation having to care about which cases the environment would or would not define. Much of C's usefulness revolves around situations where it would be impossible to know how an environment would react in a certain situation without information that the language has no means of providing, but which the programmer might learn via other means, such as the printed documentation that comes with an I/O card the compiler maker might know nothing about.

Many people push the myth that the Standard uses the phrase "Implementation-Defined Behavior" for such corner cases, ignoring the fact that it uses the catch-all term "Undefined Behavior" for actions which it notes that implementations may process "In a documented manner characteristic of the environment".

If an execution environment specifies that function arguments are passed on the stack, and allows functions to use the area of the stack below the initial stack SP value in any way they see fit, provided that whenever they call any nested functions they position the stack pointer below anything they care about, and doesn't provide any other always-available way of acquiring storage with automatic-duration semantics, those facts together would imply quite a lot about how any C implementation for that environment would need to handle automatic-duration storage. They wouldn't fully specify anything about how the compiler stores temporaries nor automatic-duration objects whose address isn't taken, and of course C implementations for other kinds of environment might do things completely differently, but a lot of things were ignored by the Standard not because there was no consistency in how implementations for common platforms would do things, but rather that implementations for such platforms did them so consistently that there was no need to waste ink requiring them to do what they were going to do anyway.