Problem With Pointer

Discussion in 'C Programming' started by aqazi@inbox.com, Sep 8, 2006.

  1. Guest

    Hi folks
    I am having a simple problem. But I couldn't any solution.
    The code is below:
    typedef struct logintList

    {

    struct sockaddr_in clientAddr;

    char loginName[20];

    struct loginList * nextClient;

    }client;

    Now I am using a glo0bal variable.
    client *clientPtr;

    In main function I am doing malloc.
    clientPtr = malloc(sizeof(client));

    I am using this in thread created by main function.
    LIke this
    1 if(strcmp(clientPtr->nextClient->loginName, loginName) == 0)
    2 {
    3 localTempClient = clientPtr->nextClient;
    4 localTempClient->nextClient = NULL;
    5 clientPtr->nextClient = clientPtr->nextClient->nextCLient;
    6 free(localTempClient);
    7 }

    it giving me the following error:
    chatServ.c:3: warning: assignment from incompatible pointer type
    chatServ.c:1: error: dereferencing pointer to incomplete type

    I am trying to figure out whats wrong but still no luck.
    Can any one give some idea??
    Thanks
    qazi
     
    , Sep 8, 2006
    #1
    1. Advertising

  2. said:

    > Hi folks
    > I am having a simple problem. But I couldn't any solution.
    > The code is below:
    > typedef struct logintList

    ^^^^^^^^^^
    Observe the spelling, and especially count the 't's.

    >
    > {
    >
    > struct sockaddr_in clientAddr;
    >
    > char loginName[20];
    >
    > struct loginList * nextClient;

    ^^^^^^^^^
    Observe the spelling, and especially count the 't's.

    --
    Richard Heathfield
    "Usenet is a strange place" - dmr 29/7/1999
    http://www.cpax.org.uk
    email: rjh at above domain (but drop the www, obviously)
     
    Richard Heathfield, Sep 8, 2006
    #2
    1. Advertising

  3. Guest

    Richard Heathfield wrote:
    > said:
    >
    > > Hi folks
    > > I am having a simple problem. But I couldn't any solution.
    > > The code is below:
    > > typedef struct logintList

    > ^^^^^^^^^^
    > Observe the spelling, and especially count the 't's.
    >
    > >
    > > {
    > >
    > > struct sockaddr_in clientAddr;
    > >
    > > char loginName[20];
    > >
    > > struct loginList * nextClient;

    > ^^^^^^^^^
    > Observe the spelling, and especially count the 't's.

    Thanks a lot
    > --
    > Richard Heathfield
    > "Usenet is a strange place" - dmr 29/7/1999
    > http://www.cpax.org.uk
    > email: rjh at above domain (but drop the www, obviously)


    qazi
     
    , Sep 8, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    10
    Views:
    717
    Chris Torek
    Feb 4, 2005
  2. jimjim
    Replies:
    16
    Views:
    852
    Jordan Abel
    Mar 28, 2006
  3. Replies:
    4
    Views:
    1,288
    Fred Zwarts
    Jul 2, 2009
  4. A
    Replies:
    7
    Views:
    644
  5. , India

    pointer to an array vs pointer to pointer

    , India, Sep 20, 2011, in forum: C Programming
    Replies:
    5
    Views:
    466
    James Kuyper
    Sep 23, 2011
Loading...

Share This Page