In given code, a bool has been passed on to foo
as shown in mainFunc
. I am not sure if e >> 24
is a right thing to do in foo
. I believe this will only give garbage values.
void foo(bool e){
int a;
bool s;
e = e >> 24;
...
}
void mainFunc(){
int *arg = (int*)malloc(sizeof(int));
*arg = xxxx;
foo(*(bool*)arg);
}
Is this a right thing to do?
EDIT: I was more concerned about operation e >> 24
, since e is bool. won't this lead to any issue? Apologies for any misunderstanding.