sizeof () preserves the size of the word get type

Source: Internet
Author: User

learned the sizeof reserved word to get the number of bytes for different variables. However, the number of bytes is machine dependent.

#include <stdio.h>/** * Output the size of common variables * @brief main * @return  */intMainvoid) {printf ("%s\n","Now We'll print the size of the variable.");/** the size of the output short type **/printf"Short:%d bytes\n", sizeof ( Short));/** the size of the output int type **/printf"int:%d bytes\n", sizeof (int));/** output A long type of size **/printf"Long:%d bytes\n", sizeof (Long));/** output Float type size **/printf"float:%d bytes\n", sizeof (float));/** output Double type size **/printf"Double:%d bytes\n", sizeof (Double));/** the size of the output long double type **/printf"long double:%d bytes\n", sizeof (Long Double));/** the size of the output char type **/printf"Char:%d bytes\n", sizeof (Char));return 0;}

sizeof () preserves the size of the word get type

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.