What is size of void pointer in C

1 Answer

0 votes
#include <stdio.h> 

int main(int argc, char **argv) 
{ 
    // The size of any type of pointer in c is independent of data type 
    // that the pointer is pointing at
        
    void *vp;
    printf("%d\n", (int)sizeof(vp));     
    
    char *cp;
    printf("%d\n", (int)sizeof(cp)); 
    
    int *ip;
    printf("%d\n", (int)sizeof(ip)); 
    
    float *fp;
    printf("%d\n", (int)sizeof(fp)); 
    
    return(0);
}

 
 
/*
 
run:
 
8
8
8
8
 
*/

 



answered May 5, 2017 by avibootz

Related questions

1 answer 152 views
152 views asked Jun 21, 2017 by avibootz
1 answer 208 views
208 views asked Aug 23, 2016 by avibootz
2 answers 141 views
141 views asked May 12, 2023 by avibootz
1 answer 143 views
1 answer 271 views
271 views asked Jun 20, 2017 by avibootz
...