Monday, July 26, 2010

C++: Intermission 3

Like most of you, I found the concept of arrays and vectors a bit intriguing
at first. But after reading many C++ resources (including and
experiments, I was able to understand and work with vectors as though they
were regular data types.

As for functions, I understood the concept for the most part. The only thing
that I didn't get on the first try was a precaution of too many lines of
code in a given function. I thought I should just write the whole story
within a block of code. However, after listening to lectures from my
instructor and visiting his office hours, coupled with my own findings that
I couldn't really follow my code, I decided to split a long function into
smaller parts - and it worked. A function is supposed to do one thing at a
time; if it tries to do multiple things at once (unless if a function is
optimized for multiple processors), it is best to split this multipart one
into smaller ones.

I think that's all that I have to say regarding functions. Starting from
next installment, we'll go into things such as member functions (we'll
examine string and vectors more), as well as creating our own data types
(classes or objects) to help us explain where member functions came from.
// JL P.S. if you have any comments, please let me know...

No comments:

Post a Comment