How to get the size of pointer variable in C

1 Answer

0 votes
#include <stdio.h> 

int main(int argc, char **argv) 
{ 
    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
 
*/

 



answered May 5, 2017 by avibootz

Related questions

1 answer 185 views
1 answer 179 views
179 views asked May 5, 2017 by avibootz
1 answer 213 views
213 views asked Aug 23, 2016 by avibootz
1 answer 194 views
194 views asked Jun 15, 2015 by avibootz
1 answer 126 views
2 answers 184 views
...