fork download
  1. #include<stdio.h>
  2.  
  3. struct person
  4. {
  5. int age;
  6. float weight;
  7.  
  8. };
  9. int main()
  10. {
  11. struct person *personPtr, person1; personPtr=&person1;
  12. printf("Enter age: ");
  13. scanf("%d", &personPtr->age);
  14. printf("Enter weight: ");
  15. scanf("%f",&personPtr->weight);
  16. printf("Displaying: \n");
  17. printf("Age:%d\n",personPtr->age);
  18. printf("weight:%f",personPtr->weight);
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5264KB
stdin
Standard input is empty
stdout
Enter age: Enter weight: Displaying: 
Age:-1840985888
weight:0.000000