0

struct student { int age; int grade; char name[40]; }; int main() { struct student s1 ={ .age = 18,.grade = 7

Can any one tell what's wrong in this code?

27th Sep 2021, 6:26 AM
Gulafsha Syed
3 Answers
+ 8
Your code is cut off. Please save it as a playground project and link that here or, if it fits, paste it into the description rather than the title, otherwise we won't be able to tell what the issue is.
27th Sep 2021, 6:32 AM
Shadow
Shadow - avatar
+ 2
Mate u missed '.' before "name": struct student s1 ={ .age = 18,.grade = 78, name = "anjali sharma"}; Should be : struct student s1 ={ .age = 18,.grade = 78, .name = "anjali sharma"}; Also isn't it easier to just write: struct student s1 ={ 18, 78, "anjali sharma"}; ???
27th Sep 2021, 8:40 AM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
+ 1
Okk now I understand thank you.. ..
27th Sep 2021, 8:45 AM
Gulafsha Syed