Asp.net sizeof usage

Source: Internet
Author: User

Asp tutorial. net sizeof

Introduction
Pascal's memory capacity measurement function:
Determine the data type length in C language
Edit the usage of this section
Var
A: array [1 .. 10000] of longint;
Begin Writeln (SizeOf ());
End.
Output: 40000
If Integer is defined,
Output: 20000
Keyword used to judge the length of a data type in C language
Usage
Sizeof (type specifier, array name or expression );
Or
Sizeof variable name
1. Definition:
Sizeof is an operator in C/C ++. In short, sizeof is used to return the memory bytes occupied by an object or type.

# Include <iostream>
Using namespace std;
 
Int main ()
{
Char ch;
Int I;
 
Cout <sizeof ch <''; // size of char
Cout <sizeof I <''; // size of int
Cout <sizeof (float) <''; // size of float
Cout <sizeof (double) <''; // size of double
 
Return 0;
}

Instance 2

# Include <iostream. h>

Union u_tag {
Int I;
Double d;
} U = {88 };
Struct s_tag {
Int I;
Double d;
} S = {66, 1.234 };

Int main ()
{
Int size;
Size = sizeof (union u_tag );
Cout <"sizeof (union u_tag) =" <size <endl;
U. I = 100;
Cout <"u. I =" <u. I <endl;
U. d = 1.2345;
Cout <"u. d =" <u. d <endl;
Size = sizeof (u. d );
Cout <"sizeof (u. d) =" <size <endl;
Cout <"s. I =" <s. I <endl;
Cout <"s. d =" <s. d <endl;
Size = sizeof (struct s_tag );
Cout <"sizeof (struct s_tag) =" <size <endl;
}

Sizeof class

# Include <iostream>

Class EmptyClass {
};

Int main ()
{
Std: cout <"sizeof (EmptyClass):" <sizeof (EmptyClass)
<'N ';
}

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.