Question:
is C programming language a portable language?
anonymous
1970-01-01 00:00:00 UTC
is C programming language a portable language?
Four answers:
anonymous
2007-10-09 01:48:02 UTC
no. C is not a portable programming language. It depends on your compiler. if you want to write a program in linux you should read a book like "programming c for linux".

you can write C code in any hardware.

So if you want to compile your code you should download a compiler for your OS.
anonymous
2016-10-06 12:53:33 UTC
Its authentic that C and C++ are the main often used, and maximum classes are written in C, even nevertheless it is not unavoidably the superb gadget for the activity. you're able to do plenty with seen person-friendly and it is plenty easier to earnings, and that i think of easier to apply. C replaced into initially meant to be for working structures and different utility 'close to to the gadget'. it somewhat is a low-point language. At one time this gave you an benefit in velocity and 'splendor', yet at the instant i don't think of the convenience is as great because it as quickly as replaced into. I used to place in writing classes in Delphi, this replaced into years in the past so issues could be diverse now. I rewrote some areas in seen C++ yet they have been no smaller, ran no swifter. If i actually had needed C++ to be swifter i will have carried out some optimizing, yet i did not prefer to make the attempt, I had a shopper waiting to apply this gadget and it already met or surpassed his expectancies and standards. additionally C++ isn't an hassle-free 'first language'. on the faculty the place I took instructions in C, you mandatory yet another language as a pre-needful. In different words, you learn -programming- then you definately learn the c software language. maximum persons, their first language replaced into Pascal. in actuality interior the C class we wrote pseudocode previously we wrote the C code, and the pseudocode regarded only like Pascal! additionally lots of those substantial programs additionally help Delphi and seen person-friendly, somewhat for domicile windows.
anonymous
2007-10-09 01:53:19 UTC
C is not a portable programming language.
Bob R
2007-10-10 09:37:20 UTC
1)

C is definitely a portable programming language.



In front of me I have a chunk of C code that (when compiled) animates a character in opengl (an API to do 3D 'stuff'), reads data from a file, responds to keypresses, etc. It compiles without a single change on all 3 of the OSes I'm using here in work.



What stops C code from being directly compiled on other platforms are differences in system specific APIs and size differences of types - I don't view those as being part of the language itself and it's simple to write code that avoids these issues as much as possible using sizeof, etc. For system specific calls and header files then ifdefs (a special category of C/C++ command which instructs the thing turning C into machine stuff about what to read, and what to ignore amongst other things) are required.



2)

No. My ZX spectrum does not have a C compiler available for it. You could write your own operating system. If no one writes a C compiler for your operating system, then you can't compile C on it.



3)

C can't run on any hardware platform. It's text.



#include

int main()

{

printf("Hello\n");

return 0;

}



That's C. It's not doing anything apart from sitting there on your screen like the bunch of squiggly lines it is. It's certainly not running. If you want to, you can run C code through a process that will produce something else which can 'run' on hardware platforms. Typically for C these processes are compilation (turning text into stuff the machine understands) and linking (joining it up with other compiled stuff that it needs) which makes a machine specific blob of data called an executable, but there's no reason why this process couldn't generate bytecode (which could run on different platforms like a java class), or even be interpreted (where the C would be read and run all in one go).


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...