Didn't you answer you own queston before even asking it?! Man, Oh Man! You must have been nervous, what a great response you gave him, its nice code...
Here, in your question you wrote, "he asked me to write a code for single producer and single consumer using ring buffer(Circular buffer)...".
So, he wanted a quick ring buffer implementation, did you write him a linked_list implementation?