Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NEWBIE QUESTION ABOUT C/C++

Status
Not open for further replies.

docmeizie

Programmer
Aug 5, 2003
326
0
0
US
I will be starting a C class next week and I was wondering what is the defining difference between C programming and C++ programming. Plus I would like to know if there are any free programming environments for the two. Any advice/insight would be greatly appreciated. thank you in advance.

If I take a peek in your Windows, to fix a problem, does that make me a "Peeping Tom"? Hmmmmmmmmmmv [pc1][shocked]
 
The difference (i.e. the '++') is that in C++ it's possible to make classes (among other).
Classes allow you to make functions, the initializing code and exit code, the functions and such, all in one package. In a class you can define weather or not a function is 'Public' (known to the whole damn project), 'Private' (known ONLY inside the class). This means that you can make finished functions with finished interface (input- and outputdata types) that can hold a lot of internal functions and the function 'automatically' initializes itself whenever needed (could be reserving memory, setting initial values and such) and terminating itself whenever needed (could be freeing memory, setting flags and such).
The general idea is that by using classes certain functions/values/buffers and such in that class is non-existing and can therefor NOT be callen/used/messed-up by the 'Big Program' OUTSIDE that class.
It is impossible/very hard in C to protect the different parts in the same way.
Also there are more functions to access but they are really only functions that you could do yourself.

Totte
 
Couple other notes:
- C forces you to declare all your variables at the beginning of your functions. Very annoying once you're used to C++ and use scope (especially in for loops).

- In C, you cannot overload operators or functions.

- In C, you gotta use malloc() and free(). Can be cumbersome when you're used to 'new' and 'delete'.

Under Linux, there's gcc that's free. And you can use KDevelop if you've got KDE installed.

Under Windows, there's the Borland C compiler that's free. Not sure about an IDE though. I'd just get an editor that allows you to configure tools (compilers). A friend of mine uses emacs, but I don't like that.


A programmer is a device for converting Coke into software.
 
For Windows, BloodShed Dev-C++ is pretty good one! Full IDE + compiler. And it's free...
Btw, it says "C++", but every C++ compiler can compile pure-C code.
 
It means you should learn some C before you go into the ++.

C for dummies is a good start. if you can still find it.

tomcruz.net
 
Well the class is core C expanding into C++ and Java. So I should be able to handle things pretty darn good. Thanks guys for your help.

If I take a peek in your Windows, to fix a problem, does that make me a "Peeping Tom"? Hmmmmmmmmmmv [pc1][shocked]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top