The following code shows an Example of Representing 2D Arrays Using Pointers.
//Representing a 2D array using pointers
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void BubbleSort(int *arr, int Length, void (*sw)(int*, int));
void swap(int *arr, int y);
void BubbleSort(int *arr, int Length, void (*sw)(int*, int))
{
int i, j, t, finished=1;
for(i=0;i<9;i++)
{
for(j=0;j<9-i;j++)
{
if(*(arr+j) > *(arr+j+1)){
(*sw)(arr, j);
finished=0;
}
}
if(finished)
break;
}
}
void swap(int *arr, int y)
{
int t;
t=*(arr+y);
*(arr+y)=*(arr+y+1);
*(arr+y+1)=t;
}
int main()
{
int i, j;
int arr1[2][5]={{4,9,2,1,3}, {12, 10, 7, 8, 6}};
int arr2[2][5]={{12, 10, 78, 55, 2}, {10, 40, 22, 3, 6}};
int (*p1)[5], (*p2)[5];
p1=arr1;
p2=arr2;
printf("First Array...\n");
for(i=0;i<2;i++)
{
for(j=0;j<5;j++)
{
printf("%d ", *(*(p1+i)+j));
}
printf("\n");
}
printf("\nSecond Array...\n");
for(i=0;i<2;i++)
{
for(j=0;j<5;j++)
{
printf("%d ", *(*(p2+i)+j));
}
printf("\n");
}
printf("\nElement by element sum of both of the above arrays...\n");
for(i=0;i<2;i++)
{
for(j=0;j<5;j++)
{
printf("%d ", *(*(p1+i)+j) + *(*(p2+i)+j));
}
printf("\n");
}
return 0;
}
Output

Further Reading
50+ C Programming Interview Questions and Answers
C Program to Find Factorial of a Number
- AI
- Android
- Angular
- ASP.NET
- Augmented Reality
- AWS
- Bioinformatics
- Biometrics
- Blockchain
- Bootstrap
- C
- C#
- C++
- Cloud Computing
- Competitions
- Courses
- CSS
- Cyber Security
- Data Science
- Data Structures and Algorithms
- Data Visualization
- Datafication
- Deep Learning
- DevOps
- Digital Forensic
- Digital Trust
- Digital Twins
- Django
- Docker
- Dot Net Framework
- Drones
- Elasticsearch
- ES6
- Extended Reality
- Flutter and Dart
- Full Stack Development
- Git
- Go
- HTML
- Image Processing
- IoT
- IT
- Java
- JavaScript
- Kotlin
- Latex
- Machine Learning
- MEAN Stack
- MERN Stack
- Microservices
- MongoDB
- NodeJS
- PHP
- Power Bi
- Projects
- Python
- Quantum Computing
- React
- Robotics
- Rust
- Scratch 3.0
- Shell Script
- Smart City
- Software
- Solidity
- SQL
- SQLite
- Tecgnology
- Tkinter
- TypeScript
- VB.NET
- Virtual Reality
- Web Designing
- WebAssembly
- XML