Posts

Showing posts with the label Pointer of Array

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