Answers for "return pointer to struct in C"

C
1

return pointer to struct in C

typedef struct {
  char name[20];
  int age;
} Info;

Info* GetData() {
  Info *info;

  info = (Info *) malloc( sizeof(Info) );
  scanf("%s", info.name);
  scanf("%d", &info.age);

  return info;
}
Posted by: Guest on May-15-2021

Code answers related to "return pointer to struct in C"

Code answers related to "C"

Browse Popular Code Answers by Language