What does Foo and Bar mean?

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.