Results 1 to 3 of 3

Thread: /t and headers

Hybrid View

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Posts
    4

    /t and headers

    djscsi (Visitor) Feb 23, 2002
    I just started learning C++, and I'm trying to figure out what \t stands for in a statement.

    Example of statement

    cout << "I am:\t" << myAge << "\tyears old.\n";


    Can someone also explain to me what headers are and what they do?

    Thanks for the help

    Kenny
    Get paid to host your website with NO ADS.

    http://www.talknet.cc

  2. #2
    Zaei
    Guest
    \t is the tab character.

    A header file is a file that usually contains function prototypes. For instance, including string.h, you get access to all of the various string functions, and when you include windows.h, you get access to all of the various windows API functions.

    Z.

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Since the compiler scans your code from top to bottom without ever looking ahead, you'll get an error when you call a function that is declared later:
    Code:
    int main()
    {
      func(4);  // error: the compiler doesn't know the name "func"
      return 0;
    }
    
    void func(int i)
    {
    // do something
    }
    This is where "function prototypes" come in. A function prototype looks like the normal function definition except that it has no code. It's purpose is just to tell the compiler that there indeed is such a function. The prototype for the "func" above would be:
    void func(int i);

    You don't need to specify a name for the parameter, so this would be legal too:
    void func(int);


    A header file is usually a collection of function prototypes and type definitions.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width