explain about pointer to sturture with examples
Answers
Answered by
0
Answer:
We have already learned that a pointer is a variable which points to the address of another variable of any data type like int , char , float etc. Similarly, we can have a pointer to structures, where a pointer variable can point to the address of a structure variable.
Answered by
0
Answer:
Explan#include <stdio.h>
struct person
{
int age;
float weight;
};
int main()
{
struct person *personPtr, person1;
personPtr = &person1;
printf("Enter age: ");
scanf("%d", &personPtr->age);
printf("Enter weight: ");
scanf("%f", &personPtr->weight);
printf("Displaying:\n");
printf("Age: %d\n", personPtr->age);
printf("weight: %f", personPtr->weight);
return 0;
ation:
Similar questions