In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what is the basic data type of C language". The content of the explanation in this article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought. Let's study and learn what the basic data types of C language are.
1. Data types contained in C language
As shown in the following figure:
2. Basic data types of C language
The six keywords short, int, long, char, float and double represent the six basic data types in the C language.
When formatting the output:
Int d
Short d
Long ld
Float f
Double lf
Char c
% x hexadecimal
% o Octal
% s string
% p generally outputs the value of the pointer as a hexadecimal integer with the prefix 0x
The memory size cut out by short on a 32-bit system is 2 byte
The memory size cut out by int is 4 byte.
The memory size cut out by long is 4 byte.
The memory size cut out by float is 4 byte.
The memory size cut out by double is 8 byte.
The memory size cut out by char is 1 byte.
(note: this refers to the general situation. Different platforms may be different. Specific platforms can be tested with the sizeof keyword.)
3. Sample code
/ / introduce the header file # include # include void main () {int i; printf ("Please enter an integer"); scanf ("% d", & I); printf ("% d\ n", I); float f = 10.01; printf ("% f\ n", f) / find the number of bytes occupied by a type, specifically related to the operating system printf ("bytes of int type% d\ n", sizeof (int)); printf ("bytes of float type% d\ n", sizeof (float)); printf ("number of bytes of double type% d\ n", sizeof (double)) / / the standard way to write a loop. Loop variables need to be extracted, otherwise int n = 0; for (; n) is compiled under GCC in Linux environment.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.