【COMP281 WEEK3 LEC5-6】

LEC 5

Function declaration

returnType functionName(type1 parameter1,type2 parameter2,...);

Function declaration consists of 4 parts:

- Return type

- Function name

- Parameter list

- Terminating semicolon

>> Return type 

The actual body of the function can be defined separately. This is called Function Prototyping 函数原型

【COMP281 WEEK3 LEC5-6】_第1张图片

>> In applications with multiple C programs, function prototypes are typically provided in header files

     -  i. e., the .h files that programmers include in their code

>> All functions are defined at the “top level” of C programs

    - (Usually) visible to the linker

    - Can be linked by any other program that knows the function prototype

>> Function Declaration vs Function Definition: In Summary

【COMP281 WEEK3 LEC5-6】_第2张图片

Calling a Function 

【COMP281 WEEK3 LEC5-6】_第3张图片

LEC 6

Arrays

>> An array consist of contiguous memory locations.

>> The highest address corresponds to the last element / The lowest address corresponds to the first element

【COMP281 WEEK3 LEC5-6】_第4张图片

 >> Declare an Array 

【COMP281 WEEK3 LEC5-6】_第5张图片

【COMP281 WEEK3 LEC5-6】_第6张图片  

【COMP281 WEEK3 LEC5-6】_第7张图片

>> Two dimensional array

【COMP281 WEEK3 LEC5-6】_第8张图片

【COMP281 WEEK3 LEC5-6】_第9张图片​​​​​​​ 

Declare : 

【COMP281 WEEK3 LEC5-6】_第10张图片

Example 2 :  

【COMP281 WEEK3 LEC5-6】_第11张图片

【COMP281 WEEK3 LEC5-6】_第12张图片

Debugging

Just some usage of debugging mode

你可能感兴趣的:(COMP281,javascript,开发语言,ecmascript)