Can you please explain this code? It seems a little confusing to me
Is “a” a double array? I would think it’s just an integer, but then in the cout statement it’s used as a double array. Also in the for loop condition it says a<3[b]/3-3, it makes no sense to me, however the code compiles and runs. i’m just having trouble understanding it, it seems syntactically incorrect to me
int a,b[]={3,6,5,24};
char c[]="This code is really easy?";
for(a=0;a<3[b]/3-3;a++)
{
cout<<a[b][c];
}
Wow. This is really funky. This isn’t really 2 dimensional array. it works because
cis an array and there is an identity in the C language that treats thisas the same as this
so this code translates into a loop that increments a while
a < (24/3-3)since3[b]is the same asb[3]and b[3] is 24. Then it usesa[b](which is the same asb[a]) as an index into the array c.so, un-obfuscated this code is
which is broken since b[4] doesn’t exist, so the output should be the 3rd, 5th, 6th and 24th characters of the string c or
followed by some random character or a crash.