include<stdio.h>

struct address{
        char city[20],country[20],state[20];
        };
struct customer{
        int acount;
        char name[20];
        float bal;
        struct address add;
};
void display(struct customer * ,int);
void main()
{
    int i,size;
    printf("enter the number of customers");
    scanf("%d",&size);
    struct customer cus[size];
    struct customer * c[size];
    for(i=0;i<size;i++)
    {
        printf("!");
        scanf("%s",&cus[i].name);
        printf("!");
        scanf("%d",&cus[i].acount);
        printf("!");
        scanf("%f",&cus[i].bal);
        printf("!");
        scanf("%s",&cus[i].add.city);
        printf("!");
        scanf("%s",&cus[i].add.state);
        printf("!");
        scanf("%s",&cus[i].add.country);
        c[i]=&cus[i];
    }
                void display(c,size);
}
void display(struct customer * c[],int size)
{       int i=0;
    for(i=0;i<size;i++)
    printf("name %s "/acount %d balance %f address %s %s %s"/,c[i]->name);//c[i]->acount,c[i]->bal,c[i]->add.city,c[i]->add.state,c[i]->add.country);
    //return 0;
}

Edited 3 Years Ago by Nick Evan: Fixed formatting

I agree With the Ancient Dragon..
"&" is used only when you are scanning for an int,float etc.
for strings and characters, there is no need of doing that!!

scanf("%s",cus[i].name); //for string
scanf("%d",&a.b); //for int || float

This article has been dead for over six months. Start a new discussion instead.