Hi all,

Just started learning C.I have some basic queries.They may sound silly to you.But please bear with me.

-What is the difference between Linking,Runtime and Compilation Error?
-What does getchar() actually do?
-How do turbo C++ and Visual C++ compilers differ from each other?I mean...in what aspects?Do C functions like printf(),etc. give different outputs when compiler is changed?

Thanks


  1. First you write code in some text editor. It doesn't matter what editor, it could even be notepad.
    Then you have to compile that code.
    Compilation refers to the processing of source code files (.c, .cc, or .cpp) and the creation of an 'object' file. This step doesn't create anything the user can actually run. Instead, the compiler merely produces the machine language instructions that correspond to the source code file that was compiled. read for more
    Compilation error is therefore something that occured during this phase, most likely syntax error (misspelled some function name, or trying to do something that C doesn't allow)

    So, after compilation, you have object files. In simple programs you have only one object file, so it's difficult to understand need for it (why not just build everything at once?).
    But if you have more different files that you want to merge into one program, first you have to compile every single one into object.
    Then it's linker's job to take all object files and to make executable out of it.
    Linker error is most likely definition/declaration error (you can have function defined in one file, and declared in another. If these two aren't identical linker error occurs).

    Runtime error 99% of the time has to do with evil horrible pointers. It happens at the time program is working, and therefore, the mistake cannot be located so easily.
    Mostly has to do with program trying to acces/alter forbidden memory, OR program altering memory it should not!

  2. char getchar(void); Returns one character from stdin buffer (a.k.a. your keyboard)

  3. They differ a lot, since turbo c++ compiler is ANCIENT.
    There is something that is called standard C++ language. It wasn't fully defined at turbo c++ time, so some things that were differently defined don't work nowadays.
    My advice is: don't go with turbo c++, get some new compilers.
    And try not to use c++ compilers, although they should work with C :)
    To answer specific question: printf() is the same as before.
Comments
Very well explained. Thanks
Nice effort.
Nicely put

They differ a lot, since turbo c++ compiler is ANCIENT.
There is something that is called standard C++ language. It wasn't fully defined at turbo c++ time, so some things that were differently defined don't work nowadays.

But, for a new student, these differences can be minor. I rarely have a problem switching from one to the other. (maybe I just know too much)

And try not to use c++ compilers, although they should work with C :)

I am unaware of any compilers that are C only designed in the last 18-20 years, especially based on the recommendation to get a new compiler. Virtually all compilers today are C++ compilers and, since C++ is (guestimate) 75% or more C, they all compile C without problems.

I am unaware of any compilers that are C only designed in the last 18-20 years, especially based on the recommendation to get a new compiler. Virtually all compilers today are C++ compilers and, since C++ is (guestimate) 75% or more C, they all compile C without problems.

Will turbo C++ allow C99 standard things? If it compiles C code, not C++.
(I don't know if a turbo c++ compiler can compile C like plain C or it compiles it as C++?)

>Will turbo C++ allow C99 standard things?
Most modern compilers don't compile C99. It's not a popular enough standard even to be completely implemented, much less widely implemented. You'll be hard pressed to find a C++ compiler that isn't very stable with C89 though, provided you pass it the right switches to compile as C instead of C++.

>I am unaware of any compilers that are C only designed in the last 18-20 years
LCC Win32 is strictly C, and is being actively developed with the goal of C99 conformance.

This article has been dead for over six months. Start a new discussion instead.