mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-16 09:16:44 +00:00
Updated Basic Assembly tutorial (markdown)
parent
934a2e77b5
commit
1508111b8d
@ -407,7 +407,7 @@ int doSomeMath(int a, int b){ //Function declaration
|
||||
```
|
||||
Let's go through this example line by line.
|
||||
The first line is the function declaration, we are telling the C compiler that the following block of code is our function called *doSomeMath*, and that it accepts two **arguments** of *int* type: a and b. We are also telling the compiler that the **return type** of the *doSomeMath* function is *int*.
|
||||
In the second line (`int result = 0;`) we are declaring one **local variable** of type *int* called *result*. The local variables are stored in memory, so the compiler needs to know how much space to reserve for each variable.
|
||||
In the second line (`int result;`) we are declaring one **local variable** of type *int* called *result*. The local variables are stored in memory, so the compiler needs to know how much space to reserve for each variable.
|
||||
The following 4 lines are simple statements that can each be translated into single instructions.
|
||||
The last statement (`return result`) indicates that we want to **return** to the callee (The code that *called* this function) the value inside the *result* local variable.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user