I want the first character in string example1 to print out. Using example1[0] seems to work, but for some reason having an int variable have that same value will output 49. Why does this happen, and how can I make the LOG(print) print 1 instead of 49?
#include <iostream>
#include <string>
#define LOG(x) std::cout<<x<<std::endl;
int main() {
std::string example1 = {"1 2 3 4 5"};
int print = 0;
LOG(example1[0]);
//this prints 1
print = example1[0];
LOG(print)
//this, somehow, prints 49. Why?
}