john_conner
john_conner

Reputation: 162

two or more data types in declaration

#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
    struct student
    {
        char name[30];
        int roll_no;
        char add[40];
        char subject[15];
    }
    struct student p;

    printf("Enter the name of student:\t");
    scanf("%s",p.name);
    printf("Enter the roll no. of student:\t");
    scanf("%d",&p.roll_no);
    printf("Enter the address of student:\t");
    scanf("%s",p.add);
    printf("Enter student's subject:\t");
    scanf("%s",p.subject);
    printf("\nThus the name of student is:%s \nHis/her roll no is :%d \n He/she lives    at:%s \t and his subject is:%s",p.name,p.roll_no,p.add,p.subject);
    getch();
}

The error message is---

13error: two or more data types in declaration of `p'

i am using code blocks

Upvotes: 3

Views: 5047

Answers (1)

Ferenc Deak
Ferenc Deak

Reputation: 35408

Put a ; after the structure definition...

Upvotes: 11

Related Questions