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,939 questions

51,876 answers

573 users

How to find the size of int, long, char, float and double in C

1 Answer

0 votes
#include <stdio.h> 

int main(void) 
{ 
    int i;
	long l;
    char ch; 
    float f; 
    double d; 
  
    printf("Size of int = %d\n", (int)sizeof(i)); 
	printf("Size of long = %d\n", (int)sizeof(l)); 
    printf("Size of char = %d\n", (int)sizeof(ch)); 
    printf("Size of float = %d\n", (int)sizeof(f)); 
    printf("Size of double = %d\n", (int)sizeof(d)); 
     
    return 0; 
} 
   
   
   
/*
run:
   
Size of int = 4
Size of long = 4
Size of char = 1
Size of float = 4
Size of double = 8
 
*/

 



answered Aug 11, 2019 by avibootz
...