Pass structure to function

struct book
{
    int id;
    float price;
    char name[15];
};

void display(struct book b1)
{
    printf("%d\t%f\t%s",b1.id,b1.price,b1.name);
}

int main()
{
    struct book b1 = {1,250.75,"ABC"};

    display(b1);

    return 0;
}

No comments:

Post a Comment