#include <stdio.h>
#include <stdlib.h>
struct person
{
char name[50];
int age;
};
int main()
{
struct person *p = (struct person *)malloc(sizeof(struct person));
if (p == NULL)
{
printf("Memory allocation failed\n");
return 1;
}
strcpy(p->name, "John Doe");
sprintf(&p->age, "%d", 30);
printf("Name: %d\n", p->name);
printf("Age: %d\n", p->age);
free(p);
return 0;
}