This is also possible in mql. Not every time a function is called, it is called twice more - there is a return at the beginning of the function.
It's called recursion.
https://ru.wikipedia.org/wiki/Рекурсия
https://habr.com/ru/post/275813/
This is also possible in mql. Not every time a function is called, it is called twice more - there is a return at the beginning of the function.
It's called recursion.
https://ru.wikipedia.org/wiki/Рекурсия
https://habr.com/ru/post/275813/
I am rewriting one of the libraries on mql, following your advice ))
Also, advise a good book that's informative and not too long.
I read Straustrup at uni, but I don't think you need a textbook on basic language constructs, you already have programming experience, you don't need to read from scratch.
I've never written in C#, but I used to write Windows programs. When I decided to try my hand in C# the online help was very helpful, any small questions clarified, I read short articles on this resource, recursion C++ is briefly described here
https://metanit.com/cpp/tutorial/3.6.php
General C++ tutorialhttps://metanit.com/cpp/tutorial/, I doubt you'll find more concise information than on this site ;)
- metanit.com
I read Straustrup at uni, but I don't think you need a textbook on basic language constructs, you already have programming experience, you don't need to read from scratch
I've never written in C#, but I used to write Windows programs. When I decided to try my hand in C# the online help was very helpful, any small questions clarified, I read short articles on this resource, recursion C++ is briefly described here
https://metanit.com/cpp/tutorial/3.6.php
I doubt you will find any more concise information than on this site ;)
You just need to understand the language. The main difficulty there is that the whole code is written through pointers and goto, and there is much unnecessary stuff with memory allocation and then deletion.
So it may be stated that mql and CY are absolutely different languages. Even such simple constructs as passing pointers instead of arrays into a function don't work here, it's very hard to rewrite.
It's easy to get into the language, the main difficulty there is that all code is written through pointers and goto, there is a lot of unnecessary stuff with memory allocation and then destruction
That's why it's obvious that mql and CY are absolutely different languages. Even such simple constructs as passing pointers instead of arrays into a function don't work here, it's very hard to rewrite.
That's what makes C++ so interesting - it's based on working with pointers. The processor doesn't know names of identifiers (names of variables), it only knows relative data offsets (links to memory addresses) and the referenced data needs to be typed - that's what a pointer does - it describes the type of data and where the data is stored in memory
MQL is really a different language
- metanit.com
That's what's interesting about C++ - it works with pointers, all the flexibility of the language is based on working with pointers - aka full imitation of working with processor memory, processor doesn't know names of identifiers (variable names), it knows only relative data offsets (in fact references to memory addresses) and data by reference must be typed - that's what a pointer does - it describes data type and location where data is stored in memory
MQL is really a different language
Yes, thanks, I am already familiar with pointers, and the book has
The site is handy, by the way, added it to my favorites.
here's a good video lecture course for the lazy, from c to cp
Here is an example from the library header:
structures are created with pointers to something unclear (apparently, they are arrays that don't exist yet), then I understand that a ...er...variable of this structuremine_score; with the same name is declared?
typedef struct mine_score { int n; /* number of rows of M */ int *m; /* number of cols of M[i] for each i */ double **M; /* the (equi)characteristic matrix */ } mine_score;
we'll have to deal with that too
and then a f-i is declared which will write its result directly into the memory space of this variable?
mine_score *mine_compute_score(mine_problem *prob, mine_parameter *param);
Here is an example from the library header:
structures are created with pointers to something unclear (apparently, they are arrays that don't exist yet), then I understand that a ...er...variable of this structuremine_score; with the same name is declared?
we'll have to deal with that too
and then we declare a f-that will write its result directly to this variable's memory location?
No, the data type declared here is mine_score, which is a mine_score structure.
And the function returns a pointer to this structure, which will be created inside this function. Accordingly, the purpose of the function is to create an entity of type min_score and transfer ownership of it to the scope of the function call.
Maxim Dmitrievsky:
this will also have to be dealt with
and then a f-i is declared which will write its result directly into the memory space of this variable?
I forgot typedefs a long time ago, thanks MQL help to remember these cumbersome constructions)), apparently it's just a declaration ofmine_score type, which is a structure and structure description was "pasted" into type definition ( typedef ) , but I could be wrong, here is a similar question discussed and quite detailed explanation:
http://qaru.site/questions/13054/typedef-struct-vs-struct-definitions
and then you declare a f-i that will write its result directly into the memory space of this variable?
In C++, the programmer is in charge of memory allocation, so if the result of a function returns amine_score* pointer, the one who receives this pointer must allocate memory, i.e. it's not a variable but a pointer to the data
- 2009.11.04
- user69514
- qaru.site
I forgot typedefs a long time ago, luckily MQL help me remember those cumbersome constructions)), it seems to be just a declaration of typemine_score, which is a structure and structure description was "pasted" into type definition ( typedef ) , but I could be wrong, here is a similar question discussed and quite detailed explanation:
http://qaru.site/questions/13054/typedef-struct-vs-struct-definitions
In C++, memory allocation is the responsibility of the programmer, so if the result of a function returns amine_score * pointer, whoeverreceives that pointer should allocate the memory, i.e. it's not a variable but a pointer to the data
#include "pch.h" #include <iostream> using namespace std; int* Foo(int i) { int* x = new int(i); return x; } int main() { int* x = Foo(5); cout << *x; delete x; return 0; }
I allocated memory inside the function and freed it in the scope of the variable I passed the reference to.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
how does this syntax work? is the f-e within itself? 2 times as well
Also, can you recommend a good book that's informative and not too long?
I've got one.
Б. Kernighan, D. Ritchie
The C programming language.
Edition 3 revised