#

Introduction Structure Data with C + +

Data structure is one of the fundamental knowledge to learn programming, if you want to deepen more about the programming world, we must recognize from the requirements - in terms of creating the program. Here I will give an introduction of a data structure:
Function
Useful function to collect the statement, which can run into a block and run it back only by the name of the function of intermediate. Many functions are also used to accommodate the lines that are often used in a program.
Declare functions can be done in two ways, namely:
~ Header function without parameters
typeData namaFungsi ()
Example:
Int JumlahIsi ()
Double Random ()
Char * Name

Writing header function without parameters begins with a data type and followed by the name of the function, open parenthesis, brackets and close ('()'). If the function does not return value, the type of data used is void.
~ Header function with parameters
typeData namaFungsi ()
Example:
THE int (int a, int b)
Double ArcCon (double x)
Void List (int n, char * header)

Writing header function with nearly the same parameters with the function without parameters, which begins with the type of data, and the name and function followed by the parameters of each separated by commas with type.
Formal parameters and the Actual
If you have a function of the parameters that are in parenthesis (), parameters such as the formal parameters, while there are parameters on the command line caller function as the Actual parameter.
Transfer Parameters
When we call a function with parameters, there have been actual delivery of the parameters of the actual parameters to the formal parameters. Delivery of these parameters can be done in two ways:
Transfer the parameters by value (the value)
The value stored in the parameter sent to the function to be processed, but the results are not asked to be returned. In this mode, the flow direction 1, the caller from the procedure to procedure.
Transfer the parameters by location / reference (the reference)
Transfer the parameters by location often also known as the transfer of parameters by reference. In this case, the only location transferred only to be processed, and the results are returned and stored in a location that has been transferred it. In this mode, can occur 2-way flow of the caller function to function and sebalikya.
Recursive Function
This function to call himself, has used because of advantages, namely the writing line programs can be more brief. However, this function also has shortcomings, which require more memory because each time the program called by himself, needed some additional memory space.
Reference information can be retrieved from the books be by "Dwi Sanjaya"

0 komentar:

Posting Komentar

My Store