Phonebook in C++ won't work : I need to do a phonebook, and so far I've done this:


    #include<stdio.h>
    #include<malloc.h>
    typedef struct
    {
    	char Name[10];
    	char Address[10];
    	long Phone_number;
    }Phonebook;
    void main()
    {
    	int Counter, Number = 0;
    	long Number_of_residents;
    	Phonebook *Information = (Phonebook*)malloc(sizeof(Phonebook));
    	scanf("%ld", &Number_of_residents);
    	for (Counter = 0; Counter < Number_of_residents; Counter++)
    	{
    		Information = (Phonebook*)realloc(Information, sizeof(Phonebook)*(Counter + 1));
    		gets(Information[Number].Name);
    		Number++;
    		gets(Information[Number].Address);
    		Number++;
    		scanf("%ld", &Information[Number].Phone_number);
    		Number++;
    	}
    }

Problem is, when I type in "Address" it stops working.

What did I do wrong here?

Thank you.

