BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

C Program to find the Size of int, float, double and char

Last Updated: September 25, 2017 by Chaitanya Singh | Filed Under: C Programs

This program finds the size of data types such as char, int, float, double.

Example: Program to find the size of data types in C

In this program, we are using the sizeof() operator to find the size of data types. When the sizeof is used with the primitive data types such as int, float, double and char then it returns the amount of the memory allocated to them.

#include<stdio.h>
int main()
{
    printf("Size of char: %ld byte\n",sizeof(char));
    printf("Size of int: %ld bytes\n",sizeof(int));
    printf("Size of float: %ld bytes\n",sizeof(float));
    printf("Size of double: %ld bytes", sizeof(double));
    return 0;
}

Output:

Size of char: 1 byte
Size of int: 4 bytes
Size of float: 4 bytes
Size of double: 8 bytes

Check out these related C Programs:

  1. C Program to Add two numbers
  2. C Program to find number of elements in an array
  3. C Program to check if number is positive or negative
  4. C Program to arrange numbers in ascending order
  5. C Program to find Quotient and Remainder

Top Related Articles:

  1. C Program to concatenate two strings without using strcat
  2. C Program to Find ASCII value of a Character
  3. C Program to check Armstrong number
  4. C Program to read and print employee details using structure
  5. C Program to Print an Integer entered by the user

About the Author

I have 15 years of experience in the IT industry, working with renowned multinational corporations. Additionally, I have dedicated over a decade to teaching, allowing me to refine my skills in delivering information in a simple and easily understandable manner.

– Chaitanya

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2012 – 2025 BeginnersBook . Privacy Policy . Sitemap