Posts

Showing posts with the label Pointer to 2D Array

Pointer to 2D Array पॉइंटर टू 2D ऐरे

 A pointer variable which stores the base address (memory address of the first element) of a 2D array is commonly used to access the elements of that array. It is explained as a pointer to 2D array in introductory C programming. एक पॉइंटर वेरिएबल जो 2D ऐरे के बेस एड्रेस अर्थात उसके पहले एलिमेंट का मेमोरी एड्रेस स्टोर करता है, उसे सामान्यतः पॉइंटर टू 2D ऐरे के रूप में समझाया जाता है। Syntax: data_type array_name[row_size][column_size], *pointer_name; pointer_name = &array_name[0][0]; Example: int mat[3][3], *p; p = &mat[0][0]; In the above example, pointer p stores the memory address of the first element of 2D array mat , that is, mat[0][0] . उपरोक्त उदाहरण में पॉइंटर p , 2D ऐरे mat के पहले एलिमेंट अर्थात mat[0][0] का मेमोरी एड्रेस स्टोर करता है। C Program for Pointer to 2D Array #include <stdio.h> #include <conio.h> void main() { int mat[3][3] = { {2, 4, 5}, {1, 0, 1}, {3, 7, 3} }; int *p, i, j; clrscr(); p = ...