hi
i want To Write a PhonBook program in c which will accept a Name and a Number from the User an save them in a struct, the problem is how to create a new structure name every time :
here is the could , though its not work but it will clear i what i mean .
#include <stdio.h>
#include <stdlib.h>
struct PhoneBook
{
char FullName[50];
long PhoneNumber;
};
void get_id()
{
char Name[50];
long Number;
printf("Please Enter A Label for The Contact:\n");
scanf("%s",&Name);
struct PhoneBook Name;
printf("please Enter The Name of the Contact :\n");
gets(Name.FullName);
printf("Enter The Phone Number :\n");
scanf("%d", &Name.PhoneNumber);;
printf("The Phone Number of %s Save as %d", Name.FullName, Name.PhoneNumber);
}
void main()
{
get_id();
}
for example i dont what to write the name of the contact manuale like :
struct PhoneBook John
struct Phonebook Eli
and Then use them , i just what them to be created automaticaly as the user enters the name .