-
c++ and c question
I'm taking some programming classes again, and the school requires an introduction to the C programming language class. My many credits of C++ classes dont seem to proclude me from it, but I don't want to bore the hell out of myself in an introductory class. So, I'm going to take the final to avoid the course, only I've never used C, only C++.
My question would be, then, at an introductory level, what are the differences that one should know about? I figure they're mostly syntax, scan/print instead of cin/cout or stdio instead of iostream, but I'm really not sure.
-
for an introductory class, you probably should brush up on string manipulations (char arrays), structs, pointers...
Ammo
-
On your basic level, the only thing that I remember off of the top of my head, is the following:
Your IO is different from C to C++ (as you said with printf/scanf).
Your objects in C++ are structs in C and are much more limited as to what you can do with them.
After that, the more advanced features start to get a little more confusing. If memory serves there is no operator overloading in C but there are things that you can do that are similar with functions. I don't think there are any templates or anything like them in C. I am also wanting to say that C doesn't readily support traps/exception throwing like C++.
Anyway, the biggest thing is that C is not nearly as object oriented as C++ and so the philosophy you would take in design is a little different than you may be used to, but most of the things you will run into will probably be related to differences in syntax and includes. At the very least it will probably make you appreciate C++ a little more :)
Neb
-
I found C very enjoyable and extrmely useful. I frequently write C programs. Depending on the structure of the course an intro C might not be that bad. Obvious differences C uses stdio.h and does not have classes -but everything you do in a class can be done in a struct (except inhertiance). I also discovered that my upper level course all required C to complete assignments and not C++ (I graduated 4 years ago this might have changed).
Post above very similiar -beat me to it by a few moments -butr I'm still going to leave it.
-
-
i wish i could take a C/C++ class :( Lucky bastard :P