Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Why, its pretty logical
(int *) p
Casts the void pointer into an into an int pointer and
* (int *) p
Dereferences the new int pointer.
It does exactly is it should. -
tueor765y@metamourge I don't get what's wwrong with ((*int)p)* or (*int)p*
(*int)p casts p
p* dereferences
But the compiler interprets the * as multiplication
Am I missing something about precedence? -
@nitwhiz star before shit means you point at shit. Star behind shit means you make more shit (multiplication)
Help with C code
int main()
{
int x =10;
void *p = &x;
printf("%d", ((int*)p)* );
return 0;
}
I'm trying to cast p to and int, for dereferencing it and printing the value of x, but Im getting an "expected expression before ) token" in the line for printf.
question