I need help in the following definitions: ptr, foo.
Printable View
I need help in the following definitions: ptr, foo.
... What he said.Quote:
Personally, I thinks its all to easy to get carried away with over-decoration of variable names.
Variable names along the lines of m_sprgszName are just painful.
One other fairly common practice is to have pointer typedefs. If you hade a linked list, and dealt mostly with node*s instead of nodes, you might have:
typedef node* node_ptr;
foo is just a common arbitrary name for something, often a function. It is commonly used in combination with another name called bar:
I suppose you could use somehting like jumpin and jehosephat instead of foo and bar, but foo-bar has some funny historical implications, sorta like "Kilroy was here", so it has just stuck.Code:#include <iostream>
using namespace std;
void foo()
{
cout << "Hello" ;
}
void bar()
{
cout << " World!" << endl;
}
int main()
{
foo();
bar();
return 0;
}