I'm a beginner in C and I was wondering if C versions are backwards compatible so I know if I watch the correct type of tutorials.
I'm a beginner in C and I was wondering if C versions are backwards compatible so I know if I watch the correct type of tutorials.
backwards compatible? mostly no
forwards compatible? mostly yes
What I mean is
When the C workgroup (WG14) publishes a new standard, most of the programs that were compatible with the previous standard are also compatible with the new standard.
However, new programs written according to the new standard do not necessarily comply with the older standard(s).
In other words... you can (mostly) write C89 and compile with any compiler (C89, C94, C99, C11, C17, C2x); however if you write C17 it may have features that are not available in C11 or previous.
Well no and yes. But i don't remember there being a function that was popular and suddenly stopped existing, normally they just slowly turn obsolete or its some undo, most people work on the same version and most tutorials out there are in the most recent or a safe revision for you to work in, specially if you are learning, I've never encountered that problem in 2-3 years of hard coding in C(except in foreign libraries, you should worry about those) ill proceed to copy pasta from the wiki https://en.wikipedia.org/wiki/C11_%28C_standard_revision%29
The optional bounds-checking interfaces (Annex K) remain controversial and have not been widely implemented, and their deprecation or removal from the next standard revision has been proposed.[20] Even Microsoft, a main proponent of this interface, does not conform to the definition.[21] In addition, Annex K does not include the more useful TR24731-2 (dynamic allocation functions), such as vasprintf and open_memstream.[22] The few open-source implementations include Open Watcom C/C++'s "Safer C" library[23] and safeclib.
But im gonna assume you are here to learn C, so you shouldn't need to worry about these sudden deprecations
Ok i had to creep into the user because i felt this sort of question could only come... From a person who delved or interacted with python before. This is the big reason i dislike python is because every other major version a bunch of functions gets broken and you have to fix all of it, this in my few hours of python so im not talking as a person who worked with python for weeks or did any serious or hard projects in python But no in C unless you are all about those obscure macro's and preprocessor's you should be able to use the most well known functions to do anything, and especially for learning, you never have to worry that your functions will one day break specially if you're young. This is because unlike python the C libraries aren't as extensive and come in my opinion with the bare minimum this makes it run faster and break less often
C standards are not backward compatible - code written under the latest standard is not guaranteed to build with compilers that only support earlier versions.
C standards are (mostly) forward compatible - code written under older versions of the standard should build with compilers that implement the most recent version, apart from a few breaking changes over the years (C99 eliminated implicit int declarations and removed the gets library function from the standard library).
The committee responsible for the C standard works very hard to make sure any changes don't break existing code, but sometimes that's not possible.
If you're just now learning C, learn using the most recent versions you have available to you. The most recent versions of most C compilers should support C17; if not they should support at least C11.