The code appears to just be copied from somewhere, so as far as we can tell, you have shown zero effort in tackling this assignment.
Tell us specifically where you start to not understand the code, and we can help you bit by bit instead of just writing the comments for you. Give us a guess at what you think a line you don't understand is doing. If it's a certain keyword or function you don't understand, try searching it online.
that code does not do anything.
I mean it pokes values into the piratey arr variable and then throws the values away, zero sum game of nothing accomplished. It looks like a quick example of how to use malloc, at a guess? Its a little hard to read with the braces not aligned and the bad variable names and such.