Can you guess the output without the help of code editor ?
If yes, then comment the output in the below comment section.
#include <stdio.h>
#include <stdlib.h>
struct res
{
char *name;
int age;
}*ptr;
int main()
{
char name[100] = "Dhanashree";
ptr = (struct res *)malloc(sizeof(struct res));
ptr->name = name;
ptr->age = 28;
printf("name = %s\n", ptr->name);
printf("age = %d", ptr->age);
return 0;
}
Top comments (0)