Some friends asked: foo, what does bar mean? Why do C ++ books always see this word.
I Googled and found that there was no good Chinese answer. This is a good answer on Wikipedia. Translate it here.
Translation:
TermsFoobar,Foo,Bar,BazAndQuxIt is often used as a placeholder name in computer programming or computer-related documents. When variables, functions, or commands are less important,Foobar,Foo,Bar,BazAndQuxIt is used to act as the names of these entities. The purpose of doing so is to describe a concept and describe an idea. These terms do not have any meaning in use cases. Foobar is often used independently. When multiple entity examples are required, foo, bar, and baz are often used in order.
Original article:
The termsFoobar,Foo,Bar,BazAndQuxAre sometimes used as placeholder names (also referred to as metasyntactic variables) in computer programming or computer-related documentation. [1] They have been used to name entities such as variables, functions, and commands whose purpose is unimportant and serve only to demonstrate a concept. the words themselves have no meaning in this usage.FoobarIs sometimes used alone;Foo,Bar, AndBazAre sometimes used in that order, when multiple entities are needed.
// C code example #include <stdio.h>int foobar(int *pi){ *pi = 1024; return *pi;}int main(){ char foo[] = "Hello,"; char bar[] = "World!"; printf("%s %s\n", foo, bar); int baz = foobar(); printf("%d, baz"); return 0;}
References
==============
Http://en.wikipedia.org/wiki/Foobar