#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;
}复习指针数组以及如何把二维数组赋值给二维指针
最新推荐文章于 2025-07-25 16:52:37 发布
本文介绍了一个链表加法的实现方法,并展示了如何进行多维数组的赋值与元素访问。通过具体的C++代码示例,读者可以了解到链表节点的创建与连接过程,以及链表相加的具体算法实现细节。此外,还涉及了C语言中多维数组赋值给多维指针的方法及数组元素的访问方式。

1万+

被折叠的 条评论
为什么被折叠?



