I am not sure what you meen but usually if you write a line of code it is best to write a comment on the same row as the code to the right will say if there is space.
However it doesn´t matter where in you code you have your comments for the compiler to be effectively. It just skipps over the comments. There is no priority.
If you write comment for example under a code. Tell in the code that you refer to the above code and do a hint to what you refer to.
>How can i write comment in professional way to explain my code
Copied from my reply to a similar question on cprogramming.com:
The way I explain commenting to my team is that any given piece of code causes you to ask one of three questions:
1) "What is it doing?"
2) "Why is it doing that?"
3) "How is it doing that?"
Code and comments work together to answer those questions.
Question 1 is always answered with a comment.
Question 2 is always answered with a comment. Code can't tell you why it's doing something.
Question 3 is always answered with code. The very definition of code is to outline the steps for solving a problem.
With that in mind, any comment that doesn't answer question 1 or 2 is a bad comment. Our code reviews take comments very seriously, and I often find myself following this line of conversation:
Me: "What's this doing?"
Coder: "It's doing <blah blah> for <blah blah> to <blah blah>."
Me: "Why did you have to tell me that?"
Coder: "Because it's badly commented?"
Me: "You got it in one."
 Transparent code also answers this question, but transparency is too subjective. So I just tell my team to treat question 1 as an "always comment". This saves the newbies from an experienced coder's ego, and it saves experienced coders from a newbie's bad judgement.