I know this is a strange question, but I have been really confused about this lately.
I have been looking in some repositories in github, and both approaches seem to be used in practise. So, what's the correct way in english grammar to write comments in this pattern?
// create an integer to store the sum.
int i = 1 + 1;
// creates an integer to store the sum.
int i = 1 + 1;
Google's style guide recommends to use third person instead of imperative.
Your question is probably a duplicate of this one, so take a look over there. I guess, in the end, it's down to your personal preference, whether you use imperative or 3rd person. This is also reflected in the different opinions in the linked question. Just be consistent within your project/organization and everything is fine.