Skip to content

Instantly share code, notes, and snippets.

@pastagatsan
Last active August 29, 2015 14:03
Show Gist options
  • Save pastagatsan/ea0e5968557611383330 to your computer and use it in GitHub Desktop.
Save pastagatsan/ea0e5968557611383330 to your computer and use it in GitHub Desktop.
Supposed to get the line number of a character.
int get_line(char * string, int epos)
{
int i = 0, j = 0;
while (true)
{
if (string[j] == '\n') { i++; }
if (j == epos) { return i; }
j++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment