Consider the following implementation of of stack:

#include

#define size 4

char s[size];

int top = -1;

void push(char*, char);

char pop(char*);

int main( )

{

char a,b,c,d;

push(s,a);

push(s,b);

push(s,c);

push(s,pop(s));

printf("%c",pop(s));

return(0);

}

void push(char* a, char b)

{

if(top==size) { printf("overflow");}

else{ a[++top] = b; }

}

char pop(char* a) {

 if(top==-1) {printf("underflow");}

 else { return(a[top]);}

 top--;

}

Value printed by above code is:

1
a
2
b
3
c
4
None of the above

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation