Understanding structs

Started by
35 comments, last by yayo_99 18 years, 4 months ago
Malloc is just a function that was around before C++'s new...not a big deal, its not hard to use it instead. I use malloc even when using C++, along with printf also.
Advertisement
yeah
i found this:
http://cplus.about.com/od/beginnerctutoria1/l/aa010602a.htm

i think i will start doing all this lessons, hope i can finish before my exam :(
if you know C++ I dont know what your problem is...just use malloc instead of new and struct instead of class and printf instead of cout
Yeah but i am still learning, in my first exam i started using <vector.h> but at the end i couldn't finish it, so i started again doing it as my teacher style but no time :'(
Quote:Original post by Fallen God
You are wrong I believe, it makes a 25 character long string. 0-24


Yes, there are 25 characters, but the last character should be '\0' or you'll run into difficulties with string functions. This brings the usable characters down to 24 (0-23) with array index 24 pointing to the '\0' character. I know Fallen God knows this, I'm just clarifying.

Also, if it's in C instead of C++ that means you don't even have to deal with OO exam question complexities which should make it easier on yourself. It doesn't sound like you have a firm grasp on C++ to begin with though, no offense. Good luck on exams, just keep reading tutorials and writing basic programs and it should sink in.
_______________________"You're using a screwdriver to nail some glue to a ming vase. " -ToohrVyk
I didnt say anything about \0 because I typically dont use char arrays for strings, usually use them for other things and you wouldnt need it unless you are using string functions. But yea, M2 is right, being able to just stick to C is easier because it doesnt have the object oriented stuff. Good luck though!
Thanks guys!! I am happy now!

This topic is closed to new replies.

Advertisement