Q:

What does char *p = int do ? C++

I played a bit with strings and I came across such a situation, the idea is to delete the spaces in the word s2 and I just put the number 1 and it just works.
it's not clear to me why.
what happened here and what's going in the memory?
Is it really a good solution ?
  char s2[]= " wo rl  d";
    char *h = s2;
    while(*h != '\0'){
        if(*h == ' '){
            *h=1;
        }
        h++;
    }
    printf("%s",s2);

A:

1 in ASCII table is unprintable character (start of heading - SOH). When printing it, your program will just skip over those (well, probably - ASCII is not guaranteed in any C++ program). 

what's going in the memory?

In memory, you still have those 1 at every spot.
It looks like this:
1   119 111 1   114 108 1   1   100 0       // decimal values, assuming ASCII
SOH w   o   SOH r   l   SOH SOH d   NUL     // char representations

Is it really a good solution ?

Not really. char 1 might be printed differently on some systems. strlen() will return full length of string, including those SOH characters, rather than number of printed characters (which one might expect). Iterating over this string will yield weird values. In general, working with this string later will be a mess.
It kinda works, for now, but you should probably truly remove characters instead of just replacing them with unprintables.

