I look at one pcboard and see some surface mount devices, some resistors and capacitors and leds. Does that mean that because one of those boards is a video card, all boards with resistors and capacitors and multiple layers and traces are all video cards? Nope.
Here is another example, this web page uses the english alphabet and english words. So does the new york times website, does that make this website the new york times? No they just share the same alphabet and language but are otherwise completely different.
C is a general purpose programming language that abstracts the instruction set below it. Can be used for bare metal, can be used to create different and incompatible to each other operating systems, can be used to create video games, etc. All of which use the same basic C language, some common C functions and constructions as well as function calls they have created that are specific to the target application. For each of those platforms you mention or others there may be a set of functions someone chose to create. Just like a handful of people so far including myself have given you the same answer but written it in a different way. Take 100 programmers and isolate them from each other and give them a programming task to solve a particular problem, without completely constraining their programming freedom, and you will get anywhere from 1 to 100 different, incompatible to each other solutions, likely not 1 but several common themes depending on their training and experience, and then variable names and function names that as a set are likely unique to each individual. Take the same boards you are already talking about and you will find that I certainly have my own C code that is incompatible (with the arduino functions) to run on them, as with many others, as well as incompatible with other platforms. That is the beauty of bare metal embedded programming, you are not constrained in any way, you dont have to live within the operating systems standard library calls or the guis limited set of rules, etc. complete freedom.
You may choose, and a high percentage of folks do, to play in someone elses sandbox rather than building your own, meaning use the arduino gui and their C libraries.
You can take the same pc and run different versions of windows it, linux, bsd, and a laundry list of other operating systems which at some level are using C but whose function calls are incompatible with each other. Same hardware and incompatible C, which extends to different hardware, same language, can have compatible or incompatible code. The language in no way makes them compatible.
C is used on these embedded platforms because that is the common practice, there is no other language that can replace C for this. First step for a new processor is assembly of course then almost always is C next, then maybe others if it is powerful enough to run an operating system (linux, bsd, etc). C was invented and hoped to solve the at the time problem of porting code across platforms, and so long as you have an operating system that is the case a C compatible compiler making code that RUNS ON AN OPERATING SYSTEM, will do the standard C file operations and printf and such things. But bare metal is a different story there is no operating system there is often no notion of a file system nor a display, but by common practice there is likely a C compiler which at its roots turns C into target specific assembly language. So we cheat the original idea of C bridging the gap between different computers to aid code portability, and we make because of personal choices of different individuals incompatible library calls for a specific target.