Puzzling Question - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Puzzling Question

shuvamshuvam Posts: 9Member
I faced a very puzzling question.

"Is there a program which runs in C but not in C++?"

Comments

  • tom_swtom_sw Posts: 828Member
    : I faced a very puzzling question.
    :
    : "Is there a program which runs in C but not in C++?"
    :
    I was taught that C++ is a superset of C, so any program written in C should also run (or at least be compilable) in a C++.
  • (cc)(cc) Posts: 23Member
    : : I faced a very puzzling question.
    : :
    : : "Is there a program which runs in C but not in C++?"
    : :
    : I was taught that C++ is a superset of C, so any program written in C should also run (or at least be compilable) in a C++.
    :
    wonder when or if they will save us all and make it one language
  • IDKIDK Posts: 1,784Member
    : : : I faced a very puzzling question.
    : : :
    : : : "Is there a program which runs in C but not in C++?"
    : : :
    : : I was taught that C++ is a superset of C, so any program written in C should also run (or at least be compilable) in a C++.
    : :
    : wonder when or if they will save us all and make it one language
    :
    You could say that C++ is both so, then it is one language...
  • shuvamshuvam Posts: 9Member
    : : : : I faced a very puzzling question.
    : : : :
    : : : : "Is there a program which runs in C but not in C++?"
    : : : :
    : : : I was taught that C++ is a superset of C, so any program written in C should also run (or at least be compilable) in a C++.
    : : :
    : : wonder when or if they will save us all and make it one language
    : :
    : You could say that C++ is both so, then it is one language...
    :
    This question was given by an interviewer from a software co. My friend who faced for simply freaked out by the quyestions he made.
  • IDKIDK Posts: 1,784Member
    : : : : : I faced a very puzzling question.
    : : : : :
    : : : : : "Is there a program which runs in C but not in C++?"
    : : : : :
    : : : : I was taught that C++ is a superset of C, so any program written in C should also run (or at least be compilable) in a C++.
    : : : :
    : : : wonder when or if they will save us all and make it one language
    : : :
    : : You could say that C++ is both so, then it is one language...
    : :
    : This question was given by an interviewer from a software co. My friend who faced for simply freaked out by the quyestions he made.
    :
    I got it!

    Look at this definition I got from my book: (translated from swedish)
    In ANSI-C can a global name be declared multible times, it can only be declared one time in C++

    In ANSI-C you can use void * on the right side of an asignment.

    In ANSI-C is it possible to skip a initiation, it isn't allowed in C++.

    There's some more but this should be enought.

    Happy coding wishes
    the one and only
    [b]Niklas Ulvinge[/b] [white]aka [b]IDK[/b][/white]

  • shuvamshuvam Posts: 9Member
    : : : : : : I faced a very puzzling question.
    : : : : : :
    : : : : : : "Is there a program which runs in C but not in C++?"
    : : : : : :
    : : : : : I was taught that C++ is a superset of C, so any program written in C should also run (or at least be compilable) in a C++.
    : : : : :
    : : : : wonder when or if they will save us all and make it one language
    : : : :
    : : : You could say that C++ is both so, then it is one language...
    : : :
    : : This question was given by an interviewer from a software co. My friend who faced for simply freaked out by the quyestions he made.
    : :
    : I got it!
    :
    : Look at this definition I got from my book: (translated from swedish)
    : In ANSI-C can a global name be declared multible times, it can only be declared one time in C++
    :
    : In ANSI-C you can use void * on the right side of an asignment.
    :
    : In ANSI-C is it possible to skip a initiation, it isn't allowed in C++.
    :
    : There's some more but this should be enought.
    :
    : Happy coding wishes
    : the one and only
    : [b]Niklas Ulvinge[/b] [white]aka [b]IDK[/b][/white]
    :
    :
    Thanks. It was a really really great suggestion.
Sign In or Register to comment.