Thread: pls post here tricks that you know of in C/C++, thanks

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    142

    hello, pls post here tricks that you know of in C/C++, thanks

    here, i'll give the first one,

    To use the global scope, you need to prefix the variable name with
    the scope resolution operator (: and to use the local scope, you do
    not need to do anything to the variable name since by default, the
    scope is the local scope.

    int amount = 123; // global variable
    void main()
    {
    int amount = 456; // local variable
    cout << ::amount << endl; // Print the global variable (123)
    cout << amount << endl; // Print the local variable (456)
    }

    thanks, i'm trying to collect neat C/C++ tricks and then somehow make a website for this,

    pls post only those that are hard to find, rare, not in books etc., and pls do not forget to provide a short description, thanks!
    Last edited by mickey; 04-04-2002 at 04:42 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginning Game Programming Type Books
    By bumfluff in forum Game Programming
    Replies: 36
    Last Post: 09-13-2006, 04:15 PM
  2. C programming - pls pls help me
    By sally arnold in forum C Programming
    Replies: 10
    Last Post: 01-16-2002, 04:55 AM
  3. pls help me!!
    By hanseler in forum C++ Programming
    Replies: 1
    Last Post: 12-05-2001, 08:46 PM
  4. Pls Help Me In This Question!!!
    By Joanna in forum Windows Programming
    Replies: 1
    Last Post: 10-20-2001, 02:05 PM
  5. 40 post drop
    By gamegod3001 in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 10-12-2001, 12:14 PM