Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char my_string[13]; // should create a 12 byte string with a \0 in 13th byte
- my_string[12] = '1'; // should update character '1' into the 12th position, \0 remains in 13th
- printf("%s\n", my_string); // but this prints blank?
- // I want to try and iterate over the string changing the character in position 12
- for (int i = 0; i < 10; i++)
- {
- my_string[12] = my_string[12] + 1;
- printf("%s\n", my_string); // but this just prints a blank string
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement