Platform Dependency in C

Dheeraj Patidar

In this article, I’m gonna to give a brief about platform dependency in the C language, and why C applications are run on a single platform.

Platform Dependency in C Language

Whenever we install C software, depending on the operating system we need to download and installed it. 

Let say we want to install C on Windows and Mac operating system. Windows understands .exe and MAC understands .dmg file. We also know that every application is a standalone application including programming languages. 

So, all the programming languages are stand-alone applications only. So, we need to download and installed it based on the operating system.

Whenever we install C, Compiler (to compile the application and generate machine code) + Library (to develop application) will be installed in the system. 

The Windows compiler will work for the Windows operating system only and the MAC compiler will work only for MAC operating system.

What is Platform Dependency?

Windows compiler will do a favor for Windows only and MAC compiler will do a favor for MAC system only. This is known as Platform Dependency. 

That means if we develop one application using Windows Operating System if that application can only be executed on Windows Operating System and can be run on other Operating Systems like Mac, Linux, this is called platform dependency. 

And the language used for developing such applications is called Platform Dependent language. C and C++ are platform-dependent languages.

Dheeraj Patidar

Consider one simple C program, just source code of addition of two numbers as shown below. Let name the program App.C.

Dheeraj Patidar

Now we need to compile the above source code. Because as a developer we can understand the source code but the machine cannot the source code. 

What the machine understands is the compiled code. Nothing but binary instructions This source code will be passed to two different operating systems. 

Different operating system compilers will be working for respective OS.

Windows: For Windows, the Windows Compiler will create the App.exe file. This App.exe file will work only on Windows OS and not on any other OS.

Mac: For Mac, the Mac compiler will create an App.dmg file. This App.dmg file will work only on MAC OS and not on any other OS.

For better understanding, please have a look at the below diagram.

Dheeraj Patidar

Conclusion

This all about Platform dependency in C. In the next article, I am going to give you an overview of Introduction to C Programming Language. So keep in touch with me via Facebook page, and follow me on instagram as well.


< Previous Post

  Next Post >


Leave a Reply

Your email address will not be published. Required fields are marked *