Posts

Showing posts with the label Array Pointer

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 = ...

Pointer to Array पॉइंटर टू ऐरे or Pointer of Array पॉइंटरऑफ़ ऐरे or Array Pointer ऐरे पॉइंटर

A pointer variable which stores the base address of an array of the same data type is commonly used to access the elements of that array. It is explained as a pointer to array in introductory C programming. एक पॉइंटर वेरिएबल जो उसी डाटा टाइप के ऐरे के पहले एलिमेंट का मेमोरी एड्रेस स्टोर करता है, उसे सामान्यतः पॉइंटर टू ऐरे के रूप में समझाया जाता है। Syntax: data_type array_name[size], *ptr_name; ptr_name = array_name; Example: int list[5], *p; p = list; In the above example, pointer p stores the base address of array list , that is, the address of its first element list[0] . उपरोक्त उदाहरण में पॉइंटर p , ऐरे list का बेस एड्रेस अर्थात उसके पहले एलिमेंट list[0] का मेमोरी एड्रेस स्टोर करता है। C Program for Pointer to Array #include <stdio.h> #include <conio.h> void main() { int list[5], *p, i; clrscr(); printf("Enter five integer numbers:\n"); for(i = 0; i < 5; i++) { scanf("%d", &list[i]); } p = list; ...