Operator precedence means that
if(g_start = strstr(final_url, "q=") != NULL)
is evaluated as
if(g_start = (strstr(final_url, "q=") != NULL))
which will assign 1
or 0
to g_start
.
You need to use parenthesis ()
around the start of the line to get the order of evaluation you need:
if((g_start = strstr(final_url, "q=")) != NULL)
// ^ ^
Note that your compiler should have warned you about this. e.g. MSVC gives
warning C4047: '=' : 'char *' differs in levels of indirection from 'int'