```
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
struct ListNode* addTwoNumbers(struct ListNode* l1, struct ListNode* l2) {
int carry = 0;
for(; l1->next != NULL; l1 = l1->next, l2 = l2->next)
{
int temp = l1->val + l2->val + carry;
if(temp > 9)
{
l1->val = temp - 10;
carry = 1;
}
else
{
l1->val = temp;
carry = 0;
}
}
return l1;
}
```