Skip to content

I need explanation on this array. #6653

Answered by Mukesh1489
EddiePumpin asked this question in Q&A
Discussion options

You must be logged in to vote

Lets Explain it down..
Now the struct People contains the uint256 favouriteNumber; string name; . So now People becomes user defined data type so we can store our favoriteNumber & name.

And then you have allocating a memory space in name of People , In that you can store both favoriteNumber & name . And this Function passes two parameters 1st is _name that stores to the uint256 _favouriteNumber & 2nd parameter is stores in string memory _name.

And finally we push the newPerson (newly stored ones) into the array of People[] public people;.
Now if you call 0 index position, the passed arguments in that function that displays.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@EddiePumpin
Comment options

Answer selected by EddiePumpin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants