为啥写力扣第二题写ListNode b(1,a);会报错 vs都不会给我报错
题:https://leetcode.cn/problems/add-two-numbers/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
ListNode* a,*d;
ListNode c(2);
a = &c;
ListNode b(1,a);
d = &b;
return d;
}
};