Posts

Showing posts with the label Pointer to Structure

Pointer to Structure पॉइंटर टू स्ट्रक्चर or pointer of structure पॉइंटर ऑफ़ स्ट्रक्चर or structure pointer स्ट्रक्चर पॉइंटर

 A pointer variable of structure type which stores the memory address of a structure variable of the same type is called a pointer to structure or structure pointer. एक स्ट्रक्चर टाइप का पॉइंटर वेरिएबल जो उसी प्रकार के स्ट्रक्चर वेरिएबल का मेमोरी एड्रेस स्टोर करता है, पॉइंटर टू स्ट्रक्चर (Pointer to Structure) कहलाता है। To access the data members of a structure using a structure pointer, we use the arrow operator ( -> ). स्ट्रक्चर पॉइंटर की सहायता से स्ट्रक्चर के डेटा मेंबर्स को एक्सेस करने के लिए एरो ऑपरेटर ( -> ) का प्रयोग किया जाता है। Syntax Declaration: struct structure_name *ptr_name; Initialization: ptr_name = &struct_variable_name; Accessing structure members: ptr_name->data_member; C Program for Pointer to Structure #include <stdio.h> struct student { int roll_no; char name[20]; char gender; float fees; }; int main() { struct student s, *p; p = &s; printf("Enter details of student\n"); printf("Enter ro...