C program to perform stack operation using singly linked list
Answer Posted / bin fang
And much better and simpler implementation should be like
this:
void Push(int info)
{
node *temp;
temp = (node *)malloc(sizeof(node));
temp->data = info;
temp->next = head;
head = temp;
count++;
}
void Pop(void)
{
node *temp;
temp = head;
head = head->next;
free(temp);
count--;
}
| Is This Answer Correct ? | 7 Yes | 2 No |
Post New Answer View All Answers
Why can't I perform arithmetic on a void* pointer?
Explain the use of 'auto' keyword
Explain about block scope in c?
Can you please explain the difference between syntax vs logical error?
The __________ attribute is used to announce variables based on definitions of columns in a table?
What is the difference between volatile and const volatile?
What does sizeof function do?
What is the hardest programming language?
Explain the use of function toupper() with and example code?
How can you find out how much memory is available?
What is structure pointer in c?
Write a program to show the change in position of a cursor using c
How is a pointer variable declared?
When we use void main and int main?
What would happen to X in this expression: X += 15; (assuming the value of X is 5)