3 Solved Topics

Remove Filter
Member Avatar for hacker9801

Hey. What's better, i++ or ++i? Well ++i returns the value after it's incremented, but which is faster? (not necessarily for int, user-defined types with operator++ overloaded too.)

Member Avatar for hacker9801
0
115
Member Avatar for hacker9801

If you use the new operator on a class, say [code=c++]class dummy { public: string f; }; int main(int argc, char *argv[]) { dummy *p = new dummy; return 0; }[/code] do you have to use the delete operator on [icode]p[/icode]? (since, apparently, it utilizes new.)

Member Avatar for hacker9801
0
92
Member Avatar for hacker9801

I know the & operator means address-of, but what's it do when in a function prototype? Example: [code=c++]void foo(std::string& str)[/code] or [code=c++]void foo(char& c)[/code] what's the & for in that?

Member Avatar for VernonDozier
0
107

The End.