If I write in C or C++ on for example: Windows. Is it guaranteed than I can compile and run it on any other operating system such as Mac OS, Linux, Unix-like systems? So, does it mean C or C++ is cross-platform language?
The language C itself is cross-platform, because you don't directly run C code on machines. The C source code is compiled to assembly, and assembly is the platform specific code. The only non cross-platform part are the compilers and the resulting assembly.
C was pretty much invented to write UNIX, the predecessor of Linux, and most of modern Windows is also written in C/C++, so yes, C compilers are available for both platforms.
When it's installed, you can use C++ to create code that runs on iOS and Android devices and platforms, Windows, Windows Store, and Xbox. Writing code for multiple platforms is often frustrating. The primary development languages and tools for iOS, Android, and Windows are different on each platform.
Actually C++ is not a platform dependent, but the output it produces is in .exe or other format which is depend on the platform you are using. so simply C++'s code is independent of platform, just the output comes after compilation is dependent.
If you write a C or C++ program that strictly complies with some standard, then the program should work on any platform that supplies a tool chain that complies with that standard. In that sense, C and C++ are cross-platform languages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With