Yes, although you need to fix the printf's format string, but that's not important here.
What you should do is to call this function from the main function, then compile and run your program to test that your function works. You should do this for all your functions. Don't ask whether something is correct until you've tested it. If it doesn't work, then you've answered your own question. If it works, then it is a good time to ask if it works because perhaps it only works in the few test cases that you've thought of, so peer review can help you find flaws in your program that you overlooked.