IDK what compiler you're using, but that doesn't compile with gcc. You'd have to change the mayor function to take pointers, and pass it addresses. Also change the temp int to a pointer. Lastly, don't use gets. Use fgets. Other than that, looks pretty much fine.