Thread: structs

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    115

    structs

    what is the correct way to fill out the array with the struct hello, i keep getting a warning about a brace around the initializer of the array, i dont understand what that means.

    Code:
    struct hello
    {
    char *name;
    char *sname;
    int age;
    } details[] =
    {
    "John", "Roy", 10,
    "Adam", "El", 15
    };
    there are only 10 people in the world, those who know binary and those who dont

  2. #2
    Registered User Sargnagel's Avatar
    Join Date
    Aug 2002
    Posts
    166
    Code:
    struct hello
    {
    	char *name;
    	char *sname;
    	int age;
    } details[] =
    {
    	{"John", "Roy", 10},
    	{"Adam", "El", 15}
    };

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating array of structs
    By knirirr in forum C++ Programming
    Replies: 12
    Last Post: 06-18-2008, 08:30 AM
  2. Multidimentional structs + memcpy() == FAIL
    By Viper187 in forum C Programming
    Replies: 8
    Last Post: 06-18-2008, 02:46 AM
  3. packed structs
    By moi in forum C Programming
    Replies: 4
    Last Post: 08-20-2002, 01:46 PM
  4. ArrayLists + Inner Structs
    By ginoitalo in forum C# Programming
    Replies: 5
    Last Post: 05-09-2002, 05:09 AM
  5. Searching structs...
    By Sebastiani in forum C Programming
    Replies: 1
    Last Post: 08-25-2001, 12:38 PM