Most voted "stack" questions
A stack is an optimized way to organize data in memory allocated in sequence and abandoned in reverse sequence to the input.
Learn more…116 questions
Sort by count of
-
217
votes4
answers41133
viewsWhat are they and where are the "stack" and "heap"?
What are these such stack and heap that so much is said about memory management? This is actually portions of memory as some people speak or is just an abstract concept to facilitate understanding…
-
30
votes1
answer1625
viewsWhen does Stack Overflow occur?
A question that has everything to do with the name of this site. We know that one of the most commonly used examples to demonstrate the execution stack of a program is recursion. A recursive…
-
22
votes2
answers5714
viewsHow does it work and use the Stack in C#?
I came to a part of my program where I have to apply a stack (stack) and wanted someone to give me a simple explanation and an example. The program that I’m running right now is a notepad where you…
-
20
votes3
answers4153
viewsWhy are local variables avoided in Arduino?
In several code examples for the Arduino I note that there is almost no use of variables in local scope. One of the examples present in the IDE: Analog > AnalogInput: int sensorPin = A0; int…
-
18
votes1
answer237
viewsStack and memory align operation in MASM X64
I have an application that takes a TAC code (IL) and generates an ASM code using x64 MASM. The problem is that I’m not having any compilation error, and yes, (at least that’s what I think) at the…
-
17
votes1
answer484
viewsData access performance in heap and stack and object allocation
Data access in the stack is faster than in heap? And why allocate an object to heap?
-
8
votes2
answers168
viewsWhat makes an object eligible to be allocated in the stack?
Article link: http://www.vogella.com/tutorials/JavaPerformance/article.html#Escape%20Analysis "The Programming language(Java) does not Offer the possibility to Let the Programmer decides if an…
-
7
votes2
answers326
viewsHow does the jQuery stack (stack) work?
When I learned to use the method .end jQuery, I realized that it was a powerful tool that ensures a lot of expressiveness to the code (and I’ve already seen how to integrate it to my plugins).…
-
7
votes2
answers1416
viewsWhat is the behavior of static variables in . NET?
What is the behavior of static variables in . NET? These are stored in heap or in the stack?
-
7
votes2
answers315
viewsWhy are you giving Segmentation fault in my Assembly inline?
I’m trying to call the job execve("bin/sh"...) using Assembly, but in instruction: mov %rsi,0x8(%rsi) i carry a segmentation error. This is the 64bit version of the article code "Smash the stack for…
-
7
votes2
answers212
viewsWhy Arraylist instead of Stack in the implementation of the Memento standard?
As you all know, the Memento pattern is the pattern that saves different states of objects and then retrieves them. The intention is not to retrieve the "last" to enter and then remove it? This is a…
-
6
votes1
answer80
viewsHow long is the data allocated to functions?
In one language, (I don’t know if there’s any difference in others, but you can consider Javascript) when I have this situation: function a() { b(); } function b() { c(); } function c() { d(); }…
-
6
votes1
answer132
viewsAre variables randomly allocated in memory?
In a book about C, in which I started studying variables, it said that variables were randomly put into memory, for example: int a; int b; printf("a = %d\n", &a); --> 5000 (endereço) (%d ao…
-
5
votes2
answers295
viewsWhy did a dynamic array work without the use of malloc()?
Follow the code passage below: int main(void) { int tam, vet[tam]; printf("\ndigite tam: "); scanf("%d", &tam); return 0; } I didn’t know this worked, because I’m typing the vector size at…
-
5
votes1
answer544
viewsEncryption using java stacks
In an encrypted message using stack to invert each word of a String and using the chatAt(int) to pick up specific characters from it, I had the following problem, when placing a character on the…
-
5
votes3
answers171
viewsIs it safe to create an object pointer in the stack indirectly?
My class has a method that returns a pointer to itself, and at some point I use the following : void classequalquer::metodo() { ClasseA * ponteiro = ClasseA().getThis(); //usa o ponteiro nesse…
-
5
votes1
answer107
viewsIf everything in C# inherits from Object, why aren’t all types by reference?
If, for example, a struct type inherits from the class System.ValueType (who inherits from System.Object), why it, and the other types by value, are not allocated in the heap? By making a Boxing, we…
-
5
votes1
answer732
viewsPointer pointer to change my battery. Why should I use them?
I am making a code that consists of analyzing an arithmetic expression, and checking if when I open a '(', then I must close a ')'. That is, check whether the expression is valid or not. For this I…
-
5
votes2
answers1821
viewsHow to implement a queue using two stacks
Hello, I need to implement a queue using two stacks, IE, I need to insert an integer on stack 1, and when removing an element all items on stack 1 should be transferred to stack 2, making it look…
-
5
votes1
answer1146
viewsDynamic stack - C
I’m studying dynamic stack from the code below: #include <stdio.h> #include <stdlib.h> #define tam 50 // ---- Estruturas para os tipos…
-
5
votes2
answers46
viewsInterpretation of Dive into Python on exceptions
Here is an excerpt from page 47 of the book 'Dive Into Python' about exceptions: "...You don’t need to Handle an Exception in the Function that raises it. If one Function doesn’t Handle it, the…
-
4
votes1
answer185
viewsIs there a standard "stack" data structure in Python?
If not, do you know of a good non-standard module? I would need to work with stack, but I find it very strange that there is no module stack (stack) standard in Python and at the same time there is…
-
4
votes1
answer1450
viewsManipulating batteries in C
I’m a C beginner and I have the following exercise: The Parking Stationhere contains a single boulevard that guards up to ten cars. There is only one entry/exit in the parking lot, in one edge of…
-
4
votes1
answer275
viewsWhat’s faster: Stack or Heap allocation?
This question may sound elementary but it has given me a good debate with a co-worker. I whenever I can make allocations on Stack because for me the growth of Stack is constant in time. And already…
-
4
votes1
answer105
viewsVector reading in C is wrong
struct cadastro{ int codigo; char nome[200]; char cpf[11]; char rg[10]; char tel[12]; char end[100]; }cadastro;//struct do tipo cadastro. struct cadastro cd[max];//vetor da funcao cadastro de…
-
4
votes1
answer142
viewsWhat happens to RAM if a key is pressed on the computer for a long time?
What happens to RAM if a key is pressed on the computer for a long time? Example: computer has been turned on and a key is pressed these bytes are being read by the processor and written in memory,…
-
4
votes1
answer435
viewsInfix function for post-fixed
I’m making a code that converts an infix function to post-fixed notation, for example: 4+2 to 42+. And I’m not being able to prioritize the elements, for example, when I do the expression 4+2*8, I…
-
4
votes1
answer126
viewsStack/Stack with priority in c#?
My teacher passed 2 exercises, the first was to create a stack (Stack) simple to run unit tests in this class: using System; using System.Collections.Generic; using System.Linq; using System.Text;…
-
4
votes1
answer92
viewsHow can Stack expressions handle stack variables?
I’m learning C# and I’m reading about Brazilian expressions. The question is: how does it work and why does it work? public delegate void Test(); public void Foobar(ref Test del) { int var = 10; del…
-
3
votes2
answers276
viewsResize into dynamic pointer turns dimension into garbage
I was responding to an implementation problem of Std::stack. It was easy, but I couldn’t use my first idea: Std::vector (replaced dynamic pointers forever). My code is: template <class T>…
-
3
votes2
answers24150
viewsError jQuery: Uncaught Rangeerror: Maximum call stack size exceeded
I have a simple function in jQuery, but it is showing the error: Uncaught Rangeerror: Maximum call stack size exceeded for example, there are 2 or 3 links I have on the page <a…
-
3
votes2
answers714
views -
3
votes1
answer1163
viewsCannot evaluate Expression because the Current thread is in a stack overflow state
You’re making that mistake: Cannot evaluate Expression because the Current thread is in a stack overflow state in the variable qtde adding it to the list desci. class descricaoo : IInstrucao {…
-
3
votes1
answer813
viewsHow does the "pop() " function work on a stack?
I’d like to understand how the pop in batteries. I just put the part that I don’t understand, I know that in function pop() there is also the empty check, but I only put the part I did not…
-
3
votes1
answer122
viewsC# How to change value within Parallel.Foreach
I am performing a processing inside an array of strings (lines of a file . txt). For performance reasons, I’m using the Parallel.ForEach, but there was a need to change the values of some lines that…
-
3
votes1
answer60
viewsWhat is the difference between stack frame and Execution context? Are they the same thing in Javascript?
I’m trying to deepen the operation of javascript and I’m having doubts between some definitions I found. First, a simplified representation of the javascript execution environment in the browser…
-
3
votes1
answer97
viewsHow to make a list of recursive iterations - Python
I am implementing a python Hanoi tower and I need a log of all moves. It could be a list of the states of the 3 stacks. But when I try to use the append function for this list/log, the result is the…
-
3
votes1
answer218
viewsStack implementation in C, how to pass values?
I am trying to implement a stack in C. The prompted by the teacher is already basically done which was to show an error if the stack was full or empty. But when going to main I found great…
-
2
votes2
answers183
viewsError while removing stack item
Error of the function pop?? void pop(Pilha *pilha){ if(pilha->size == 0){ puts("pilha vazia"); } else { printf("item removido: %d\n\n", pilha->itens[--pilha->size]);…
-
2
votes1
answer441
viewsJava stack intercalating values
have two stacks have to create the third interleaving the values of the two stacks created the stack and all I’m having a lock to implement the code to interlink follows the code: public class Pilha…
-
2
votes1
answer1494
viewsRemove odd numbers from a stack
In C how is it done to remove only odd numbers from a stack? I was thinking of removing item by item and moving to an array, but the stack size is not given.
-
2
votes1
answer1909
viewsPrint values from a stack
I have to make a code that prints all values of a stack in the opposite order in which they were inserted, only I can only print one value at a time, each time I want to see the previous value I…
-
2
votes2
answers1158
viewsRemove specific data on a stack
I have no idea how to remove a specific data from a stack. I tried to perform the minhaPilha.remove(); and nothing went right. Console.WriteLine("<Pilha>"); Stack<string> minhaPilha =…
-
2
votes1
answer66
viewsWhat is the java class stack growth policy?
I am doing a work on different Tacks and what I am studying increases its size to double when we introduce the (2 n+)1 element. But what is the growth policy of java.util.Stack and…
-
2
votes1
answer41
viewsRegister state in Calling covention
In the Calling Convention of ABI, the starting prologue of a new stack makes, by default, a push EBP. So far so good, but why do mov EBP, ESP if ESP is already "pointing" to the top, which - in this…
-
2
votes1
answer2486
viewsStack, pop function, it has to remove at the end
#include <stdio.h> #include <stdlib.h> typedef struct pilhaElement{ int data; struct pilhaElement *next; }PilhaElment; typedef struct pilha{ PilhaElment *head; PilhaElment *tail; int…
-
2
votes1
answer393
viewsHow to access an object attribute within a stack of Objects
I have several objects of the Vehicle class with board, model and anoFabri as attributes, inside a stack I created (Stack.java). I need to apply a method in the Stack class, which removes objects…
-
2
votes1
answer221
viewsHow to use a class array as a pointer?
How do I use a class array as a pointer? I tried several ways, but C++ didn’t let you compile by generating errors. An example of class(It’s just one example, the class I need to use is thousands of…
-
2
votes1
answer2269
viewsUsing stack concept to invert words
I am doing a work of Algorithms and Data Structure, which uses the concept of stack to do the inversion of words. However, when I am compiling the program, it is pointing out some errors that I do…
-
2
votes1
answer548
viewsStack Exercise - String with Trash
Write an algorithm, using a Stack, that inverts the letters of each word of a text finished by a dot (.) preserving the order of words. By example, given the text: THIS EXERCISE IS VERY EASY. The…