469,915 Members | 2,635 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,915 developers. It's quick & easy.

improper pointer/integer combination: op "=" error

34
I'm creating an addrecord and a delete record for a linked list below:

Expand|Select|Wrap|Line Numbers
  1. int addRecord(struct record **start, char name[], char address[], int yearofbirth, char telno[])
  2. {
  3.     struct record *temp;
  4.     struct record *temp1;
  5.     int added;
  6.  
  7.     temp = *start;
  8.     temp1 = (struct record *)malloc(sizeof(struct record));
  9.     added = 0;
  10.  
  11.     strcpy(temp1 -> name, name);
  12.     strcpy(temp1 -> address, address);
  13.     temp1 -> yearofbirth = yearofbirth;
  14.     strcpy(temp1 -> telno, telno);
  15.     temp1 -> next = NULL;
  16.  
  17.     while(temp -> next != NULL && *start != NULL)
  18.     {
  19.         temp = temp -> next;
  20.     }
  21. ......
  22. }
The check in the while loop above for "temp -> next != NULL" passes compilation.

Expand|Select|Wrap|Line Numbers
  1. int deleteRecord(struct record **start, char name[])
  2. {
  3.     struct record *current;
  4.     struct record *previous;
  5.     struct record *temp;
  6.     int deleted;
  7.  
  8.     current = *start;
  9.     deleted = 0;
  10.  
  11.     if(*start == NULL)
  12.     {
  13.         return -1;
  14.     }
  15.  
  16.     while(current -> next =! NULL)
  17.     {
  18. ......
  19. }
But the check in this while loop throws an error: warning: improper pointer/integer combination: op "="

Here's my struct.
Expand|Select|Wrap|Line Numbers
  1. struct record
  2. {
  3.     char            name[25];
  4.     char            address[80];
  5.     int               yearofbirth;
  6.     char            telno[15];
  7.     struct record *next;
  8. };
Can't figure out why =(
Oct 16 '07 #1
2 3899
Banfa
9,065 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1.     while(current -> next =! NULL)
  2.  
Should be

Expand|Select|Wrap|Line Numbers
  1.     while(current -> next != NULL)
  2.  
Alternitively tell us which line the error occured on.
Oct 16 '07 #2
jthep
34
Urgh, I must have been so frustrated that my eyes must just swept pass that. Thanks...next time I will specify which line.
Oct 16 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

10 posts views Thread by Chris Mantoulidis | last post: by
5 posts views Thread by a R T u n | last post: by
2 posts views Thread by Peter Ignarson | last post: by
20 posts views Thread by chutsu | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.