Dynamic allocation? If so which ones? I did this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
char** encrypt(char raw[1])
{
int ran1, ran2, ran3, ran4;
ran1 = rand() % 100;
ran2 = rand() % ran1;
ran3 = rand() % 1 + ran2;
ran4 = ran1 + (ran3*2);
size_t si_of = sizeof(raw);
char** enc;
enc = new char*[si_of*2];
for(size_t i = 0; i<si_of; i++)
{
*(*(enc+0)+i) = up(ran4, raw[i]);
}
char* buffenc;
buffenc = new char[5];
*buffenc = (char)ran1, (char)ran2, (char)ran3, (char)ran4;
*(*(enc+1)) = *buffenc;
delete[] buffenc;
return enc;
delete[] enc;
}
|
and my build messages have:
||=== Build: Debug in Apoxx (compiler: GNU GCC Compiler) ===|
C:\Users\Bob\OneDrive\Code\Apoxx\main.cpp||In function 'char** encrypt(char*)':|
C:\Users\Bob\OneDrive\Code\Apoxx\main.cpp|50|warning: right operand of comma operator has no effect [-Wunused-value]|
C:\Users\Bob\OneDrive\Code\Apoxx\main.cpp|50|warning: right operand of comma operator has no effect [-Wunused-value]|
C:\Users\Bob\OneDrive\Code\Apoxx\main.cpp|50|warning: right operand of comma operator has no effect [-Wunused-value]|
||=== Build finished: 0 error(s), 3 warning(s) (0 minute(s), 1 second(s)) ===|
||=== Run: Debug in Apoxx (compiler: GNU GCC Compiler) ===|
line 50 is
*buffenc = (char)ran1, (char)ran2, (char)ran3, (char)ran4;