Is sizeof char ** pointer dependent on the architecture of machine?
c, pointers, sizeof
Solution
In the original question you weren't calling `sizeof`. duskwuff fixed that for you.
The output produced was:
Size of **temp 1
Size of *temp 8
Size of temp 8
Reason:
On a 64-bit architecture, pointers are 8-bytes (regardless of what they point to)
**temp is of type char ==> 1 byte
*temp is of type pointer-to-char ==> 8 bytes
temp is of type pointer-to-pointer-to-char ==> 8 bytes
Problem
When I execute the following code: ``` int main() { char **temp; printf("Size of **temp %d", sizeof(**temp)); printf("Size of *temp %d", sizeof(*temp)); printf("Size of temp %d", sizeof(temp)); return 0; } ``` I get: ``` Size of **temp 1 Size of *temp 8 Size of temp 8 ``` What I don't understand is how does a `char` pointer have a size of `8`? Is it machine independent?