I was trying to write a program that stores the message in a string backwards into a character array, and whenever I run it sometimes it successfully writes it backwards but other times it will add random characters to the end like this:
input: write this backwards
---
sdrawkcab siht etirwˇ
---
#include <iostream>
#include <string>
using namespace std;
That was how I wrote it the first time but this assignement required us to use a character array. Anywho, I fixed it by adding a null character to reverse[spot] just before I output reverse. Thanks for your help :)