So I have this string: char *string = "amiral 1 1 H";
I want it to basically copy 'amiral' or all the letters until it reaches the first space. I have made the following while loop but for some reason it only crashes my program.
If you did not allocate any memory for tempstring, then you are pointing to random memory. If you write over random memory, your programme will crash if you are lucky, and will just be wrong if you are unlucky.