help with structures

This is a discussion on help with structures within the C++ Programming forums, part of the General Programming Boards category; what should i do if i want to give a name like Luiz to the variable endereco in the text ...

  1. #1
    Registered User
    Join Date
    Oct 2005
    Location
    Brasil
    Posts
    220

    help with structures

    what should i do if i want to give a name like Luiz to the variable endereco in the text above

    Code:
    struct database {
    int endereco;
    }

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    what "text above" ? Maybe this is what you want?
    Code:
    struct database {
    int Luiz;
    }

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7,328
    Make endereco a string variable. Then create a new instance of the database struct. Then assign "Luiz" to instancevariablename.endereco.

  4. #4
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    Code:
    struct database {
    int endereco;
    }
    what should i do if i want to give a name like Luiz to the variable endereco in the text above
    You can't. endereco is an int type. int types can only be assigned integers, e.g.

    ....-1, 0, 1, 2, 3....

    So, follow Daved's instructions.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 07-11-2008, 07:39 AM
  2. Structures, passing array of structures to function
    By saahmed in forum C Programming
    Replies: 10
    Last Post: 04-05-2006, 11:06 PM
  3. Input output with structures
    By barim in forum C Programming
    Replies: 10
    Last Post: 04-27-2004, 08:00 PM
  4. pointers to arrays of structures
    By terryrmcgowan in forum C Programming
    Replies: 1
    Last Post: 06-25-2003, 09:04 AM
  5. Methods for Sorting Structures by Element...
    By Sebastiani in forum C Programming
    Replies: 9
    Last Post: 09-14-2001, 12:59 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21