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 148 views
148 views asked Jun 21, 2017 by avibootz
1 answer 200 views
200 views asked Aug 23, 2016 by avibootz
2 answers 135 views
135 views asked May 12, 2023 by avibootz
1 answer 140 views
1 answer 268 views
268 views asked Jun 20, 2017 by avibootz
...