B
berte
what's wrong this code ?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
typedef struct{
char *name;
int no;
}Person;
int main()
{
Person *s = NULL;
s = (Person *)malloc(sizeof(Person));
printf("name: ");
scanf("%s", &s->name);
printf("number: ");
scanf("%d", &s->no);
printf("Name: %s Number: %d", s->name, s->no);
free(s);
system("pause");
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
typedef struct{
char *name;
int no;
}Person;
int main()
{
Person *s = NULL;
s = (Person *)malloc(sizeof(Person));
printf("name: ");
scanf("%s", &s->name);
printf("number: ");
scanf("%d", &s->no);
printf("Name: %s Number: %d", s->name, s->no);
free(s);
system("pause");
return 0;
}