char* c
. Затем зачем-то присваиваете переменной типа int значение типа long, что приводит к переполнению. И потом удивляетесь, почему у вас AccessViolation. bytes.push_back('\0');
char *c = &bytes[0];
num = (long)(&c);
не совсем понятно, что вы хотите получить? Адрес первого байта? #include <random>
#include <iostream>
using namespace std;
void generator(int& answer, int& x, int& c) {
random_device random_device;
mt19937 generator(random_device());
uniform_int_distribution<> distribution(1, 10);
x = distribution(generator);
c = distribution(generator);
answer = x * c;
}
int main() {
int answer, x,c;
generator(answer, x,c);
cout << answer << " " << x << " " << c;
}