Results 1 to 5 of 5

Thread: struct in c

  1. #1
    Join Date
    May 2013
    Beans
    27

    struct in c

    i am writing a struct. but initialization not work correctly.
    what is wrong!

    Code:
    typedef struct {
        int userIdNumber;
        char* userName;
        int isThere;
    
    }client;
    client clientList[MAX_USER];
    int main(int argNum , char **args)
    {
        int i;
        for(i=0;i<MAX_USER;i++)
        {
            clientList[i].userName=NULL;
            clientList[i].userIdNumber=-1;
            clientList[i].isThere=0;
        }
    }

  2. #2
    Join Date
    Aug 2010
    Location
    Lancs, United Kingdom
    Beans
    1,098
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: struct in c

    There is nothing wrong. What makes you think that there is?

  3. #3
    Join Date
    May 2013
    Beans
    27

    Re: struct in c

    because use it in condition, and works unexpectedly.

  4. #4
    Join Date
    Aug 2011
    Location
    47°9′S 126°43W
    Beans
    1,909
    Distro
    Kubuntu 12.10 Quantal Quetzal

    Re: struct in c

    Then show us where/how you use it later.

  5. #5
    Join Date
    May 2013
    Beans
    27

    Re: struct in c

    tanks, my problem is solved , i did a mistake.

Tags for this Thread

Bookmarks

Posting Permissions

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