Why do I get the error message "member access within misaligned address 0x000000000327 for type 'struct ListNode', which requires 8 byte alignment"?


  • 0
    K

    '''

         struct ListNode* addTwoNumbers(struct ListNode* l1, struct 
         ListNode* l2) {
            int c=ListNodetoInt(l1)+ListNodetoInt(l2);
            return c;
        }
    
    
    
      int ListNodetoInt(struct ListNode* a){
        int retval=0;
        int count=0;
    
       while(a->next!=NULL)
       {
         retval=(a->val*pow(10,count))+retval;
         a=a->next;  
       count++;
       }
       if(a->next==NULL){
          retval=(a->val*pow(10,count))+retval;
       }
    
    
    return retval;
    }  
    

    '''


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.