Is C Language Platform Independent?

Discussion in 'Computer Science | IT | Networking' started by sulochana anand, Aug 5, 2012.

    sulochana anand Apprentice

    Message Count:
    59
    Ratings Received:
    +5
    Engineering Discipline:
    IT
    is c platform independent?as i think it is.but it is compiler dependend.my statement is right or wrong?

    [Prototype] Ace

    Message Count:
    748
    Ratings Received:
    +165
    Engineering Discipline:
    Electronics
    Yes C is platform independent. However, it doesn't mean you can run any code on any machine. It depends on the resources you've used in the code but generally speaking, yes its platform independent.

    pawan.kumar123 Certified CEan

    Message Count:
    4
    Ratings Received:
    +0
    Engineering Discipline:
    IT
    No C is not platform independent. Platform means Operating system + hardware and with the change of this combination you need different vendor specific programs to convert you c code into a machine executable code. So for windows you need a different program(compiler) but with Linux you need different compiler to convert your c code into machine executable code form. For each platform( operating system + hardware resources) you need different compiler programs to get executable code from c programs. That's why c is not platform independent
    • The MOD Squad

    Abhishek Rawal Moderator

    Message Count:
    1,223
    Ratings Received:
    +431
    Engineering Discipline:
    Electronics & Communications
    No Sir,
    C is platform dependent , i accept.
    But, Its difficult to say that "windows need different compiler than Linux to execute the program".
    If you check out most of released compilers, 90% are 'em are compatible to both.
    & The most popular one - GCC, GNU compiler is available for both Linux & Windows.
    There are many more compilers available, some are with IDEs & some not. Some Compilers are maintained regularly & some not.
    Maintained ones becomes popular & the out-of-date compilers become extinct.
    For list of compilers :: Click Here

    [Prototype] Ace

    Message Count:
    748
    Ratings Received:
    +165
    Engineering Discipline:
    Electronics
    How you're saying that C language is platform dependent?

    If you can make programs for Windows, Linux, AVR with same syntax and language constructs, using same compiler (GCC), then what is making it platform dependent?

    True that you cannot directly port a windows program to Linux, but that doesn't mean its platform dependent.

    greatcoder Apprentice

    Message Count:
    31
    Ratings Received:
    +22
    Engineering Discipline:
    Computer Science
    @sulochana anand No C language is not platform independent.
    I think following points will give u good picture:

    1) If you have written a code on one platform, then u need to compile the same
    code on different platforms separately if want run your code on them.

    2) Some internal library functions rely on the platform OS system calls
    and may not work the same way on all platforms.

    3) Also C language behaves differently on different platforms, for example
    some architectures may follow different schemes for their data-path flow, different
    little/big endian terminology.

    sulochana anand Apprentice

    Message Count:
    59
    Ratings Received:
    +5
    Engineering Discipline:
    IT
    I think it is good discussable point that c is platform independent or not.I read in a book that c is portable.and portable means moovable.its true that on diffrent os it gives diffrent result but slightly diffrent.i think its platform independent.what u say?

    Sreejith T Certified CEan

    Message Count:
    20
    Ratings Received:
    +1
    Engineering Discipline:
    Computer Science
    very well C is not suitable to be run on every machines.....

    sulochana anand Apprentice

    Message Count:
    59
    Ratings Received:
    +5
    Engineering Discipline:
    IT
    i just wan to ask did u check it?

    Sreejith T Certified CEan

    Message Count:
    20
    Ratings Received:
    +1
    Engineering Discipline:
    Computer Science
    No I have read it on THE COMPUTER ACTIVE magazine an year ago

Share This Page