i have a problem related to the c language.

void main()
{
int marks;
clrscr();
printf("enter the marks of the student:");
scanf("%d",marks);
if(marks>=35)
{
printf("student is pass:");
}
else
{
printf("student is fail:");
}
getch();
}

but when i run this program, there is no error in the program but when i enter any input like greater than 35 marks, compiler skip the first printf statement and jump to the else statement. i enter many input such as greater and less than to 35 but compiler skip the first statement and jump at else part so what's the problem. please send me email at <email removed> early because i am worried since two days aabot that; please send reply early . than you so much.

scanf expects a pointer:

scanf("%d", &marks);

It's a wonder that your code runs long enough to have odd behavior in the if statement.

scanf("%d",marks)

narue is right you forgot the pointer & before marks

it should be

scanf("%d", &marks);
commented: Thank you for this information. I couldn't understand Narue. She's soooo technical. -4
commented: +++ +3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.