Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

oneofakind24

C and C++

This topic is 5633 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

C++ is pretty much a spin-off of C, so if I know the of C++ and I needed to compile in C would have have troubles with it or do I need to learn C first before programming in C. Thanks

Share this post


Link to post
Share on other sites
Advertisement
Since C++ is almost a proper superset of C, nearly all valid C code is also valid C++ code, so a C++ compiler will generally also compile C code. Moreover, most of the major C++ compilers seem to have a C mode. This should not be a problem.

As for the OP''s question: There are differences between C and C++. If you''re a good C++ programmer it shouldn''t take you long to learn C, as you already know most of the basics and all of the syntax, but there are differences - memory allocation/deallocation and string handling are the most glaringly obvious, but then, in a language that has no explicit support for OOP, you will likely have to learn an entirely different style of programming (modern C has borrowed type-safe constants from C++, I know; did they also borrow inline functions, or do C programmers still use macros for this purpose?). (Of course, since many people treat C++ like C with a few goodies tacked onto it, that may or may not be a problem ...)

Then of course there is the question of why you would want to program in pure C rather than C++. There are some valid reasons and I shan''t deny it; I just hope not to hear "for speed reasons" ...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!