Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,971 questions

51,913 answers

573 users

How to get size of a different types of pointers in C

1 Answer

0 votes
#include <stdio.h>
 
int main(void)
{
    printf("Size of int pointer: %lu\n", (unsigned long)sizeof(int*));      
    printf("Size of char pointer: %lu\n", (unsigned long)sizeof(char*));   
    printf("Size of short pointer: %lu\n", (unsigned long)sizeof(short*)); 
    printf("Size of long pointer: %lu\n", (unsigned long)sizeof(long*)); 
    printf("Size of float pointer: %lu\n", (unsigned long)sizeof(float*)); 
    printf("Size of double pointer: %lu\n", (unsigned long)sizeof(double*)); 
 
    return 0;
}
 
   
/*
run:
     
Size of int pointer: 8
Size of char pointer: 8
Size of short pointer: 8
Size of long pointer: 8
Size of float pointer: 8
Size of double pointer: 8
 
*/

 



answered Jul 27, 2017 by avibootz

Related questions

1 answer 107 views
1 answer 120 views
1 answer 181 views
2 answers 136 views
1 answer 109 views
2 answers 178 views
...