* arnuld:
i will tell you the *exact* reason why i am not able to learn from
"Eckel/Stroustrup". REASON is:
1.) why a function returns an /int pointer/ rather than an /int/ ?
That would presumably be because the function stores the pointer
somewhere. Could alternatively be that the function modifies the
pointed to int (which there might be other pointers to). But in this
latter case a reference argument would usually be more appropriate.
2.) why a function takes arguments as: /const string& s, char c/ rather
than /string s, char *c/ or /string *s, const char *c/ etc. etc. ?
Using 'const string&' (or written another way, 'string const&', which
means the same) instead of just 'string' is an optimization which many
programmers do as a matter of course. The reason is that we know a
reference can be passed very efficiently, but we don't know that passing
a string by value can be done efficiently. It might be that with a
'string' argument type, the compiler will optimize things, but it might
also be that the string is time-consumingly copied; hence pass-by-ref.
these 2 are the major hurdles for me. i am not able to understand their
example programmes because of these 2 issues. BUT at this point, is it
really necesary for me to understand these things?
If you're using Stroustrup's TCPPPL it's best to go forward in the path
he's laid out. Meaning, that if he uses pointers, he'll have discussed
them first. So if just follow the book's path, you should be OK.
Please just /ask/, in new, problem-specific threads, whenever you find
you're stuck on something, and include (1) some real code, (2) what you
expected as result and why, and (3) what the actual result was instead.