小编ZBa*_*Bay的帖子

在链接列表中的第 n 个位置插入显示分段错误

void Insert(int data, int n){
    Node* temp1 = new Node();
    temp1 -> data = data;
    temp1 -> next = NULL;
    if(n == 1){
        temp1 -> next = head;
        head = temp1;
        return;
    }
    else{
        Node* temp2 = head;
        for(int i; i< n-2; i++){
            temp2 = temp2 -> next;
        }
        temp1 -> next = temp2 -> next;
        temp2 -> next = temp1;
    }
}
Run Code Online (Sandbox Code Playgroud)

我遇到了分段错误,但无法找出问题所在。

c++ linked-list

2
推荐指数
1
解决办法
78
查看次数

redux-toolkit -&gt; non-serializable value detected

Error:

index.js:1 A non-serializable value was detected in an action, in the path: payload.config.transformRequest.0.

Value: ƒ

transformRequest(data, headers) {

normalizeHeaderName(headers, 'Accept');
normalizeHeaderName(headers, 'Content-Type');

if (utils.isFormData(data) || utils.isArrayBuffer(data) || utils.i…
Run Code Online (Sandbox Code Playgroud)

Slice:

export const getProducts = createAsyncThunk(
    'products/getProducts', 
    async() => {
        const res = await axios.get('http://localhost:5000/products/view-products', {withCredentials: true});
        return res;
    }
)

const getProductsSlice = createSlice({
    name : 'products',
    initialState : {
        list : [],
        status : null
    },
    extraReducers : {
        [getProducts.pending] : (state) => {
            state.status = 'loading'
        }, …
Run Code Online (Sandbox Code Playgroud)

express reactjs redux-thunk redux-toolkit

0
推荐指数
1
解决办法
692
查看次数

标签 统计

c++ ×1

express ×1

linked-list ×1

reactjs ×1

redux-thunk ×1

redux-toolkit ×1