#include<stdio.h>
void fun(int (*ptr)[4]) {
for(int i = 0; i<=2; i++) {
printf("Address of i block of arr %p\n", ptr + i);
for(int j = 0; j<=3; j++) {
printf("arr[%d][%d] = %d\n",i,j,*(*(ptr + i) + j) );
}
}
};
int main() {
int arr[3][4] = {
{11, 12, 13, 14},
{15, 16, 17, 18},
{19, 20, 21, 22}
};
int (*ptr)[4] = arr;
fun(ptr);
return 0;
}
Monday, November 29, 2021
Passing 2D Array to a function (2D Array Haua nahi hai normal array ki tarah he behave karta hai)
Subscribe to:
Post Comments (Atom)
Priority queue deleting elements after ascending inputs Gaand Fadd
using namespace std; #include<iostream> #define N 5 class pq { public: int* arr; int front; int rear; pq() { ...
-
//See sabse pehle ek khali node bana lena jiska prev and next null ho uske bad use return kar le fir saare operation perform kar lena //Tim...
-
#include<stdio.h> #include<stdlib.h> struct node { int data; struct node* next; }; void add(struct node** tail, int val...
-
#include<stdio.h> #include<stdlib.h> struct node { int data; struct node* next; }; void inElFr(struct node** head, int ...
No comments:
Post a Comment