Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/3rfaan/courses
/ push
Function
push
C/freeCodeCamp/Data Structures/stack-array.c:13–22 ·
view source on GitHub ↗
Source
from the content-addressed store, hash-verified
11
int top = -1; // empty array
12
13
void push(int x)
14
{
15
if (top == MAX_SIZE - 1)
16
{
17
printf(
"Error: Stack overflow\n"
);
18
return;
19
}
20
21
A[++top] = x;
22
}
23
24
void pop()
25
{
Callers
1
main
Function · 0.70
Calls
no outgoing calls
Tested by
no test coverage detected