By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,201 Members | 922 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,201 IT Pros & Developers. It's quick & easy.

improper pointer/integer combination: op "=" error

P: 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
Share this Question
Share on Google+
2 Replies


Banfa
Expert Mod 5K+
P: 8,916
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

P: 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.