I am trying to reverse a string. I take two pointers , one pointing to the start of the string and other at the end of the string . And then I swap the values of the pointers.
int main()
{
    char *string = "stack overflow";
    int len = strlen(string);
    char *end;
    char tmp; //temporary variable to swap values
    //pointer pointing at the end of the string
    end = string+len-1;
    printf(" value of start and end %c %c", *string , *end); //correct values printed
    while(string<end)
        {
                tmp = *string;
                *string = *end; //segmentation fault
                *end = tmp;
                *string++;
                *end--;
        }
    return 0;
}
