Trouble with arg | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Trouble with arg

I'm trying to create a program to get a person's full name, age, and gender. I have to use the function prototype -> void printPerson(Person arg); I'm having trouble printing the info out. I can enter in my info but it crashes when it goes to the print. Can someone explain? https://code.sololearn.com/cw6mZLrB2FRV

16th Nov 2020, 4:37 AM
Krista Clark
Krista Clark - avatar
1 Answer
+ 6
you were passing an array of structure variable to a function which is expecting one object. I have altered it to pass the first element of the array(the element in which you are actually storing stuff). You can change is according to your choice. Here is the fix 👇 https://code.sololearn.com/cszkz8WocYTm/?ref=app
16th Nov 2020, 5:13 AM
Arsenic
Arsenic - avatar