Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C-programming. Can anyone show me how to create a makefile, so the c-file stack2.c can be tested in MainStack.c? stack2.c: MainStack.c: stack.h: 1 I stack2.

C-programming.

Can anyone show me how to create a makefile, so the c-file stack2.c can be tested in MainStack.c?

stack2.c:

image text in transcribed

image text in transcribed

MainStack.c:

image text in transcribed

stack.h:

image text in transcribed

1 I stack2. 2 #include 3 #include 4 #include "stack,h" newstack(): function to create a new stack malloc): memory allocation The function allocates the requested memory and returns a pointer to it. 9 10 11 stack_t2x newStack(void) ( 12 13 14 stack_p -array- (int*)malloc(sizeof (int)); 15 16 17 18 19 1% 0 pop(): function to remove an integer from the stack 21 22 int 23 stack_t2* stack_p-(stack_t2 *)malloc(sizeof(stack t2)); stack_p ->capacity- 1; stack-p-> size = 0; return stack_p; pop(stack_t2* stack_p) int result; while(stack_p->array--0) 25 26 stack_p->array++ 28 29 30 31 32 result *stack_p->array; *stack_p-sarray stack_p->size- return result; 4 push(): function to insert an integer in the array. For an array with no room left for another integer, the function allocates a new array with the double size of the previous 36 37 38 realloc): function to reallocate memory size

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions