Thread: Problem with function returning a structure

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    You don't declare structs or classes inside main(). You do it outside main(). Likewise, you don't declare that sad, lonely char outside main--you do it inside main().

    Next time when you have errors, make sure you do this:
    Code:
    weapon new_weapon;  //ERROR***ERROR****ERROR
    Last edited by 7stud; 01-21-2007 at 12:32 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem getting structure to work in my function
    By Tom Bombadil in forum C Programming
    Replies: 18
    Last Post: 05-28-2009, 09:53 AM
  2. Replies: 5
    Last Post: 02-14-2006, 09:04 AM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. problem returning struct member from function
    By yukster in forum C Programming
    Replies: 6
    Last Post: 08-24-2003, 01:21 PM
  5. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM