I have this little program that performs a xor operation over two char* but I can't tell if b1 is changed after the function call. When I try to do a std::cout the program does not print anything.
#include <iostream>
#include <malloc.h>
#include <cstring>
void xorBlocks(char *b1, char *b2) {
for (int i = 0; i <5; i++) {
b1[i] ^= b2[i];
}
std::cout <<b1;
}
int main()
{
char* buffer = (char *) malloc(10);
char* previousBlock = (char *) malloc(10);
const char *iv = (const char *)"00111";
//printf(iv);
memcpy(previousBlock, iv, 5);
//printf(previousBlock);
memcpy(buffer, iv, 5);
//printf(buffer);
xorBlocks((char *) buffer, (char *) previousBlock);
return 0;
}