I have a doubt in Embedded-C and C programming language..... Please clarify my doubt...... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

I have a doubt in Embedded-C and C programming language..... Please clarify my doubt......

//EMBEDDED - C In Google,I found that Embedded-C is considered as the "HARDWARE DEPENDENT LANGUAGE". Then how does the embedded C (code) is works properly for different hardware architecture(i.e Embedded-C portability) Without any changes made on that code... --------------------------------------------------------------------- //C - Language I also found that C(code) is considered as a "PLATFORM DEPENDENT" Then how does the C(code) works properly on all systems (like Linux,Mac) not only in Windows...... How does it work properly.... Please tell me

5th Nov 2020, 1:49 PM
Yogeshwaran P
Yogeshwaran P - avatar
8 Answers
+ 5
Yogeshwaran in embedded system C and C++ used for many tasks and projects as fault tollerance and hard real system required accuracy which is acheived most by C and C++ as being close with hardware and assembly. In embedded C code is embedded and mounted over hardware like arduino and rasbaperry pi with burninh the code with USB. C code is considered as platform dependent but in embedded design it is compiled over an cross compiler according to work requirements that cross compiler will generate burnable file which is mounted at hardware and that hardware is consist of micro controller which work like an OS and this way the task is completed in embedded environment. This is just an basic step for small programs and tasks for bug fault tollernce system more mechanism is invilved witj system specific requirements according to necessity
5th Nov 2020, 2:27 PM
DishaAhuja
DishaAhuja - avatar
+ 4
You are talking about writing a piece of code and then compiling it and then executing it which will obviously work for all OS. I'm trying to explain that the compiled version of a code on a particular OS cannot be executed on some other OS.
5th Nov 2020, 2:14 PM
Avinesh
Avinesh - avatar
+ 4
Yogeshwaran , this is just a clerification of what Avinesh already said. the source code that you write will remain same for all the platforms throught the world but the code which is generated after compiling the source code will be platform dependent. That's why same program have to recopiled on another platform to work. For example If you try to run the same executable compiled on windows will not work on linux.
5th Nov 2020, 3:07 PM
Arsenic
Arsenic - avatar
+ 3
Java is platform independent mainly because of it's intermediate state which is the bytecode or the .class file. This bytecode could be executed on any operating system given that the system has a JVM which is of course OS dependent. But this is not same for C language because the the compiled .exe file is specific to that OS on which it was generated. You cannot execute the same file on a different OS.
5th Nov 2020, 2:00 PM
Avinesh
Avinesh - avatar
+ 2
For that you can refer the answer by DishaAhuja. She has explained it in much detail. You can also refer this answer which says the same thing. https://stackoverflow.com/questions/11810484/is-c-platform-dependent
5th Nov 2020, 2:35 PM
Avinesh
Avinesh - avatar
+ 2
Thank you Avinesh , DishaAhuja , Arsenic .....😊 Now I understood...
5th Nov 2020, 3:16 PM
Yogeshwaran P
Yogeshwaran P - avatar
+ 1
Avinesh then how does the C code works on Some os like Mac,Linux(sololearn),.... Without working alone on windows.....
5th Nov 2020, 2:05 PM
Yogeshwaran P
Yogeshwaran P - avatar
+ 1
Avinesh I agree with yours first case explanation.... Can you explain detaily about yours second case..... Because I can't able to differentiate yours first and second case answers.....
5th Nov 2020, 2:30 PM
Yogeshwaran P
Yogeshwaran P - avatar