- Just wondering how its different between C and C++.I learnt C language and next Semester gonna learn C++,i tried to write a program in C++ compiler using the way i learn in C but its keep error.is there difference on how to write?
Answer by Ratchetr
C++ is a superset of C. That means that any valid C program should continue to work in C++.
But there is a gotcha: C++ has much stricter type checking rules. Sloppy code that you could get away with in C may not compile in C++. Sometimes you just need to add an appropriate typecast to keep the C++ compiler happy. Other times, the C++ compiler is actually catching a bug that you were just lucky enough to get away with in C. So you have to look at the errors and warnings 1 by 1 and fix them. But then the code should just run.
- If a person knows ONLY C++ is it still possible for them to write a program in C? I am thinking of learning programming but I figure that if I can learn C++ and still write in C whats the point of learning both separately?
Answer by iyiogrenci
- Im reading a book on Allegro C++, but only some of its C++ and the rest is C, well the Scripts are saved As “.C”, Will all the commands I use in C++ Work within C, because I dont understand why a C++ book would have C controls in it? Can I use C and Learn C++ and no matter what C++ I type into a C Script it will work?
Support This Blog By Visiting Listing related to SkY BingO -
Sorry if that confusing thanks for the answers if I get some though
Answer by jplatt39
Bottom line: ALL C++ compilers compile C programs. The irony with your question of course is that Dev-C++ is just an IDE which is the front end for GCC which compiles the source code you feed it. Thats the oldest still-maintained C compiler out there, though it did pick up a C++ module along the way. But even Visual C++ will compile C programs. All of them will.