c#访问修饰符修饰无效_C中的数据类型和修饰符

c#访问修饰符修饰无效

Data Types In C

Data Types In C

C中的数据类型

C中的数据类型 (Data Types in C)

C has various data types to store data in program. C program can store integer, decimal number, character(alphabets), string(words or sentence), list etc. using various data types.

C具有各种数据类型以将数据存储在程序中。 C程序可以使用各种数据类型存储整数,十进制数字,字符(字母),字符串(单词或句子),列表等。

We need to specify the data type of variable(identifier) to store any data in it.

我们需要指定变量(标识符)的数据类型以在其中存储任何数据。

Explanation and basic usage of the concept is provided below. Data types and Modifiers have significant in-depth technical details which are not covered in this article.

下面提供了该概念的说明和基本用法。 数据类型和修饰符具有重要的深入技术细节,本文未涉及。

There are 2 categories of Data Types in C:

C中有2类数据类型

1.原始(原始)数据类型 (1. Primitive (Primary) Data Types)

These data types store fundamental data used in the C programming.

这些数据类型存储C编程中使用的基本数据。

  1. int

    整型
  2. It is used to store integer values. C program compiled with GCC compiler (32-Bit) can store integers from -2147483648 to 2147483647. The size of int is compiler dependent. It takes 4 bytes in a 32-bit compiler such as GCC.

    它用于存储整数值。 使用GCC编译器(32位)编译的C程序可以存储从-2147483648到2147483647的整数。int的大小取决于编译器。 在32位编译器(例如GCC)中,它占用4个字节。

    int myIntegerValue = 100;
  3. char

    烧焦
  4. It stores single character such as ‘a’, ‘Z’, ‘@’ etc. including number, symbol or special character. It takes 1 byte (8-bits) to store each character.

    它存储单个字符,例如“ a”,“ Z”,“ @”等,包括数字,符号或特殊字符。 存储每个字符需要1个字节(8位)。

    char myCharacter = 'A';

    Note: Every character has a corresponding ASCII value to it ranging from -128 to 127. Numbers as a character has their corresponding ASCII values too. For example, ‘1’ as char has ASCII value 49, ‘A’ has ASCII value 65.

    注意 :每个字符都有一个对应的ASCII值,范围从-128到127。数字作为字符也有其对应的ASCII值。 例如,作为char的'1'具有ASCII值49,'A'具有ASCII值65。

  5. float

    浮动
  6. It stores real numbers with precision upto 6 decimal places. It takes 4 bytes of memory and is also known as floating point number.

    它存储的实数精度高达6位小数。 它占用4个字节的内存,也称为浮点数。

    float myFloatingValue = 100.6543;
  7. double

  8. It stores real numbers with precision upto 15 decimal places. It takes 8 bytes of memory.

    它以高达15位小数的精度存储实数。 它占用8个字节的内存。

    double myDoubleValue = 180.715586;

2.派生和用户定义的数据类型 (2. Derived and User Defined Data Types)

These are made by collection or combination of primitive data types and hence known as derived data types. Details will be covered in the articles dedicated to each topic of the following:

这些是通过原始数据类型的收集或组合制成的,因此称为派生数据类型。 有关以下每个主题的文章将介绍详细信息:

  • Array

    数组
  • Structure

    结构体
  • Union

    联盟
  • Enum

    枚举
  • Pointer

    指针

C中的修饰符 (Modifiers in C)

These are keywords in C to modify the default properties of int and char data types. There are 4 modifiers in C as follows.

这些是C中的关键字,用于修改int和char数据类型的默认属性。 C中有4个修饰符,如下所示。

Modifiers In C

Modifiers In C

C中的修饰符

  1. short

  2. It limits user to store small integer values from -32768 to 32767. It can be used only on int data type.

    它限制用户存储从-32768到32767的小整数值。它只能在int数据类型上使用。

    short int myShortIntegerValue = 18;
  3. long

  4. It allows user to stores very large number (something like 9 Million Trillion) from -9223372036854775808 to 9223372036854775807. Syntax “long long” is used instead of “long int”.

    它允许用户存储从-9223372036854775808到9223372036854775807的非常大的数量( 大约 900万亿美元 )。 使用语法“ long long”代替“ long int”。

    long long myLongIntegerValue = 827337203685421584;
  5. signed

  6. It is default modifier of int and char data type if no modifier is specified. It says that user can store negative and positive values.

    如果未指定修饰符,则它是int和char数据类型的默认修饰符。 它表示用户可以存储负值和正值。

    signed int myNegativeIntegerValue = -544;
    signed int mypositiveIntegerValue = 544;
    /* Both of the statements have same meaning even without "signed" modifier*/
  7. unsigned

    未签名
  8. When user intends to store only positive values in the given data type (int and char).

    当用户打算仅在给定数据类型(int和char)中存储正值时。

    unsigned int myIntegerValue = 486;

摘要 (Summary)

It is important to understand the basic usage of data types to code and develop logic. There is a lot more about data types, however, you can easily proceed in your journey to C programming with the information provided.

理解数据类型的基本用法以进行编码和开发逻辑很重要。 有关数据类型的更多信息,但是,您可以使用提供的信息轻松地进行C编程。

翻译自: https://www.journaldev.com/26779/data-types-and-modifiers-in-c

c#访问修饰符修饰无效

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值