Are C enumerations a basic data type? Also, is the pointer type a basic data type?

Updated on technology 2024-03-07
6 answers
  1. Anonymous users2024-02-06

    Neither enumeration nor pointer types are basic data types.

    There are five basic data types in the C language: character, integer, single-precision real, double-precision real, and null. Although the length and scope of these types of data vary depending on the type of processor and the implementation of the C compiler, in the case of Bit, an integer is equal to the length of a CPU word, a character is usually a byte, and the exact format of floating-point values depends on the implementation.

    C also provides several aggregate types, including arrays, pointers, structs, commons (unions), bitfields, and enumerations.

    In addition to the vo i d type, the base type can be preceded by various modifiers. Modifiers are used to change the meaning of the base type in order to more accurately adapt to the needs of various situations. The modifiers are as follows:

    signed.

    unsigned.

    long (long type).

    short (short type). The modifiers s i g n e d, s h o r t, l o n g, and u n s i g n e d are available for both character and integer base types, while l o n g can also be used for d o u b l e (note that since long float means the same thing as d o u b l e, the a n s i standard removes the extra long float).

  2. Anonymous users2024-02-05

    Neither. The basic data types of C are: char, wchar, t, int, float, long, long long, int64, bool, short, double

  3. Anonymous users2024-02-04

    There are too many uses, have you seen the Windows API function, there are too many parameters, such as a func(int con) when con=0 to perform addition operations con=1 to perform subtraction operations, con = 2 to perform multiplication operations to perform division operations when con=3, when you call this function, directly pass 0 1 2 or 3 will be incomprehensible. This kind of number is called a magic number in programming, and in order to make it easier for others to read and write fluent ** yourself, we will use enums to gather multiple constants, such as con add con sub con mul con div, so that it is convenient for us to call and for others to read.

  4. Anonymous users2024-02-03

    If the enum is not initialized, it is omitted"= integer constant", then start with the first identifier, cis.

    The secondary assignment is given to the identifiers 0, 1, 2, .,However, when a member in the enumeration is assigned, the subsequent members are in order.

    The rule of adding 1 determines its value.

    For example, after the following enumeration, the values of x1, x2, x3, and x4 are 0, 1, 2, and 3, respectively.

    enum numx;

    When the definition is changed to:

    enum num

    x1,x2=0,x3=50,x4

    x;then x1=0, x2=0, x3=50, x4=51

    Note:1The end of each member (identifier) in the enumeration is",", it's not";", the last member can be omitted,"。

    2.Negative numbers can be assigned during initialization, and subsequent identifiers are still added by 1 in turn.

    3.An enumerated variable can only take an identifier constant in the enumeration description structure.

    For example: enum num

    x1=5,x2,x3,x4

    enum num x=x3;

    At this point, the enumerated variable x is actually 7.

  5. Anonymous users2024-02-02

    If a variable has only a few possible values, it can be defined as an enumeration type.

    The enumeration type lists the values of the variables one by one, and the values of the variables are limited to the range of the listed values.

    enum workday, weekend ;

    Among them, sun, mon ,..The SAT is called an enumeration element or enumeration constant, which is a user-defined identifier whose meaning is determined by the user and is reflected in the program.

    1. The enumerated elements are constants and cannot be assigned. sun=0; mon=1;

    2. While defining the enumeration type, the compiler gives each enumeration element a corresponding ordinal number in order, starting from 0 and adding 1 to subsequent elements in turn.

    3. You can artificially specify the ordinal number value of the enumerated element during the definition.

    enum weekday ;

    4. Only enumerated values can be assigned to enumerated variables, and if the ordinal number value is assigned, a forced type conversion must be performed.

  6. Anonymous users2024-02-01

    Eh, it seems, enumeration, is a type in itself, though.

    The enumeration element system in the enumeration variable is treated according to the constant, so it is called the enumeration constant.

Related questions
5 answers2024-03-07

The car has 2 different levels of protection. Basic Class A protection weight tonnage, which can be transported by air by A400M aircraft. This armor assembly provides 360 ° protection against millimeter bullets, as well as hollow-charge warhead shells, and at least 10 kg of ** shaped projectile warhead mines. >>>More

7 answers2024-03-07

The first if(!) a) means that if a is equal to zero, take x -- the second and third means that if b and c are not 0, it is executed. >>>More

9 answers2024-03-07

A hash table (also known as a hash table) is a data structure that is directly accessed based on the key value. That is, it accesses records by mapping key values to a location in the table to speed up lookups. This mapping function is called a hash function, and the array that holds the records is called a hash table. >>>More

3 answers2024-03-07

I have the same issue.

7 answers2024-03-07

do is used to loop.

For example. int i=1,sum=0; >>>More