Problem With Pointer

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • aqazi@inbox.com

    #1

    Problem With Pointer

    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(c lient));

    I am using this in thread created by main function.
    LIke this
    1 if(strcmp(clien tPtr->nextClient->loginName, loginName) == 0)
    2 {
    3 localTempClient = clientPtr->nextClient;
    4 localTempClient->nextClient = NULL;
    5 clientPtr->nextClient = clientPtr->nextClient->nextCLient;
    6 free(localTempC lient);
    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

  • Richard Heathfield

    #2
    Re: Problem With Pointer

    aqazi@inbox.com 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

    email: rjh at above domain (but drop the www, obviously)

    Comment

    • aqazi@inbox.com

      #3
      Re: Problem With Pointer


      Richard Heathfield wrote:
      aqazi@inbox.com 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

      email: rjh at above domain (but drop the www, obviously)
      qazi

      Comment

      Working...