Size of Void Pointer:
Size of any type of pointer in c is independent of the data type which is pointer is pointing i.e. the size of all type of pointer (near) in C is 4 bytes either it is char pointer, double pointer, function pointer or the null pointer. A void pointer is not an exception of this rule and size of the void pointer is also 4 bytes but it also depends on compiler as well..in modern days compiler like GCC, pointer takes 8 bytes of size..whereas, in dos based compiler like turbo c or turbo c++, pointer takes 4 bytes
C program:
Output: 4
Credit: Gaurav
Size of any type of pointer in c is independent of the data type which is pointer is pointing i.e. the size of all type of pointer (near) in C is 4 bytes either it is char pointer, double pointer, function pointer or the null pointer. A void pointer is not an exception of this rule and size of the void pointer is also 4 bytes but it also depends on compiler as well..in modern days compiler like GCC, pointer takes 8 bytes of size..whereas, in dos based compiler like turbo c or turbo c++, pointer takes 4 bytes
C program:
Output: 4
Credit: Gaurav
but it depends on compiler as well..in modern days compiler like gcc ,pointer takes 8 bytes of size..where as in dos based compiler like turbo c or turbo c++,pointer takes 4 bytes
ReplyDeleteyeah totally right
ReplyDelete