How do i create a struct variable for nested struct in c? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

How do i create a struct variable for nested struct in c?

struct stu{ char name; int clas; struct date { int dates; }; }; How can i create a struct variables for date inside main ? Like stu date num; It show error

18th Feb 2019, 1:07 PM
Programmer Raja
Programmer Raja - avatar
2 Réponses
+ 7
struct stu { char name; int clas; struct date { int dates; }; }; int main() { struct stu s, *ps = &s; s.dates = 74; printf("%d\n", ps->dates); // 74 return 0; }
18th Feb 2019, 3:23 PM
Anna
Anna - avatar
0
write one of the structure variable in another structure
24th Feb 2019, 1:49 AM
Shubham Vijaykumar Patil
Shubham Vijaykumar Patil - avatar