Do functions like Push/pop exist in the arduino programming language, or do i have to make them myself?
Welcome to the forum
The Arduino does not have its own programming language, rather it is programmed in C++
What are you hoping to do with push and pop functions ?
What do you want to use them for?
There are push and pop instructions in the machine code, these are used for parameters or return addresses. They push the system stack and heap, located at either end of the memory space.
You are better off making your own, if it just for general buffer manipulation.
oh sorry, i was talking about using these to access arrays.
i want to use them to edit arrays
Std::vector has things like that...
And
Std::list
You don't edit arrays with push and pop.
And if you can not use the standard template library, there are other implementations of vectors available.
but doesnt processing havethese functionalities?
The processor does but the language doesn't apart from the stuff already posted.
True in C++, not true in other programming languages - e.g. Python supports stack operations on arrays.
(Of course, OP is asking about C++ specifically, I just wanted to clarify this.)
Do you mean Processing? Yes:
"The push() function saves the current drawing style settings and transformations, while pop() restores these settings" .
Processing is based on Java.
Arduino is based on C++.
You can implement a simple FILO in fixed memory like an array. It just won't be as versatile or easy to use as the STL containers. But, in some instances it would be enough. So if it's a really simple job, roll your own.
without really knowing what the final purpose of your arrays are a real good advice can't be given.
From the too small base of information given so far I estimate that to use push/pop is not nescessary.
But this is just a guessing in the fog due to not enough information
best regards Stefan
Yes, vague questions produce vague answers.
OP asked if Arduino has push and pop functions, which is a precise question, and they have gotten a precise response. Where's the problem?
You haven't been here long enough to recognize the wide range of intentions behind the questions asked here. The anonymity of the poster is what makes the question vague.
Push and pop are not even technical terms. So what they got was a survey of what's possible. That might or might not be sufficient for the poster's unknown purpose.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.