复习指针数组以及如何把二维数组赋值给二维指针

#include <cstddef>
#include <iostream>
using namespace std;
struct ListNode {
	int val;
	ListNode *next;
	ListNode(int x) : val(x), next(NULL) {}
};
void listadd(){
	int flag = 0;
	ListNode* pre = new ListNode(0);
	ListNode* l1 = new ListNode(1);
	l1->next = new ListNode(2);
	ListNode* l2 = new ListNode(1);
	l2->next = new ListNode(2);
	ListNode* l3;
	l3 = pre;
	while (l1 != NULL || l2 != NULL){
		int val1 = 0;
		if (l1 != NULL){
			val1 = l1->val;
			l1 = l1->next;
		}
		int val2 = 0;
		if (l2 != NULL){
			val2 = l2->val;
			l2 = l2->next;
		}
		int temp = 0;
		temp = val1 + val2 + flag;
		l3->next = new ListNode(temp % 10);
		flag = temp / 10;
		l3 = l3->next;
	}
	if (flag == 1){
		l3->next = new ListNode(1);
	}

	
}
float *find(float(*pionter)[4], int n);

int main(){
	int iArr[2][3] = { 0, 1, 2, 3, 4, 5 };
	int* p = iArr[0];
	int(*pArr)[3] = iArr; //如何把一个二维数组赋值给二维指针,[3]是写死的规定。 调用这个变量和定义这个变量含义不同,C语言缺点,不能返回数组。
	int a = *(*(pArr + 1) + 2);
	int b = *(*(iArr + 1) + 2);
	return 0;
}

    原文作者:gx262091291
    原文地址: https://blog.csdn.net/gx262091291/article/details/76408834
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞