How I can assign value for any struct to another struct? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How I can assign value for any struct to another struct?

Suppose If I have three students I wanna I build struct for Name Age And Avrage. I will enter the data for tow students and I wanna Assign data for the first student to the third student?

22nd Feb 2022, 2:16 PM
ABUBAKAR ALHOMIDY
ABUBAKAR ALHOMIDY - avatar
3 Answers
+ 2
Do you want 1 struct that contains the data of all 3 students? Or 1 struct for each student?
22nd Feb 2022, 2:27 PM
Lisa
Lisa - avatar
+ 1
1. Define a struct with name, age and avg fields, use arrays 2. Initialize struct, set data of student 1 3. Get input and assign to struct's arrays 4. Assign data of 1st to 3rd
22nd Feb 2022, 3:18 PM
Lisa
Lisa - avatar
0
1 for all 3 student
22nd Feb 2022, 2:50 PM
ABUBAKAR ALHOMIDY
ABUBAKAR ALHOMIDY - avatar