Variables, pointers and arrays

five thousand and forty-seven Unauthorized reproduction is prohibited Understanding the course
Course Introduction
discuss {{interaction.discussNum ? '(' + interaction.discussNum + ')' : ''}}
Suitable for people
1. Students who have a certain programming foundation 2. Students who will be engaged in programming 3. Students who have not studied systematically
You will learn
Learn more about knowledge beyond textbooks.
Course Introduction

 1.png

data type

#Essence

The essence of data type is memory address+data length

#Role

It is a model that can easily locate data and specify data size  

#Representation

Basic Data Type

Custom Data Type     

Use the typedef keyword to define typedef unsigned int UINT     

Use the # define macro to define # define UINT unsigned int     

Use struct/union to define structure     

Defining constant values using enum

#Usage

[Attribute] Data type variable name;     

  auto int iVal;  

Attributes can be omitted

There are three types of data type attributes     

auto static register 

#Auto attribute

Note: Auto in C and auto in C++have different meanings  

In C language, it is an "attribute" of a variable      

In the compiler, the default attribute of local variable data type is auto      

Auto attribute default variable is allocated in stack space      

In C11 standard, the auto attribute is obsolete       

Global variables cannot use the auto attribute

//For example: # include

//At this time, the coded compilation will not pass

//Because auto default data is allocated in the stack space

//But our iVal is a global variable

//The global variable will be allocated in the global variable area, and the compiler will conflict

//Compilation will report a bad storage class error (VS2015 compiler) auto int iVal=0; int main(){    return 0;} 

#Static attribute

……

#Register attribute

……

 2.png

Expand more
release
 head portrait

{{ item.user.nick_name }} {{ EROLE_NAME[item.user.identity] }}

Topping note
 Discussion Chart
{{ item.create_time }} reply
  • delete

    Are you sure to delete?

    confirm
    cancel
  • {{item. is_top==1? 'Cancel topping': 'topping'}}

    The discussion that has been set to the top, do you want to replace the existing one?

    confirm
    cancel
{{ tag.text}}
 head portrait
{{ subitem.user.nick_name }} {{ EROLE_NAME[subitem.user.identity] }}
{{ subitem.create_time }} reply
delete

Are you sure to delete?

confirm
cancel
release
{{pageType==='video '?' The discussion area grabs the sofa, and you can get double credits': 'The discussion area is empty, please say two sentences~'}}
release
{{tips.text}}
{{ noteHeaderTitle }} note {{hasMyNote? 'My notes':' Take notes'}}
{{hasMyNote? 'My notes':' Take notes'}}
Quality Notes
Updated on: {{$dayjs. format ('YYYY-MM-DD HH: mm: ss', item.last_uptime*1000) }}
 head portrait
{{ detail.username }}

Public notes are visible to others and have the opportunity to be rated as "high-quality notes" by the administrator

{{ noteEditor.content.length }}/2000

Public Notes
preservation
put questions to

The lecturer will answer your questions as soon as possible. If you choose to ask questions in public, you can get more help from students.

Record time point
Record the time when the video is played when asking questions, so as to facilitate subsequent viewing
Open questions
Submit