Article View: comp.lang.c.moderated
Article #2097Re: Need help with Stacks
From: Miguel Carrasquer Vidal
Date: Tue, 27 Feb 1996 12:27
Date: Tue, 27 Feb 1996 12:27
66 lines
1760 bytes
1760 bytes
arlyn@airmail.net (Arlyn Chesley) wrote:
>Need help with getting data onto and off of stacks
#include <stdio.h>
void stack_push(int);
void stack_pop(void);
/* warning: not ANSI C */
void _pascal stack_push_bonus(int);
int stack_new(void);
int stack_free(int);
int main()
{
int i=stack_new();
printf("About to push value on the stack [stackp = %p]\n",
&i);
stack_push(i);
printf("About to push another value on the stack [stackp =
%p]\n", &i);
stack_push_bonus(++i);
stack_pop();
printf("Just popped a value off the stack [stackp = %p]\n",
&i);
return stack_free(i);
}
void stack_push(int value)
{
printf("About to pop value %d off the stack [stackp = %p]\n",
value, &value);
stack_pop();
}
void _pascal stack_push_bonus(int value)
{
printf("value is %d [stackp = %p]\n", value, &value);
}
void stack_pop(void)
{
(void)0;
}
int stack_new(void)
{
return 0;
}
int stack_free(int value)
{
return --value;
}
==
Miguel Carrasquer Vidal ~ ~
Amsterdam _____________ ~ ~
mcv@pi.net |_____________|||
========================== Ce .sig n'est pas une .cig
Technical Details
Message-ID:
<4gutao$i7g@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<4gq8pl$or2@solutions.solon.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: mcv@pi.net (Miguel Carrasquer Vidal) Newsgroups: comp.lang.c.moderated Subject: Re: Need help with Stacks Date: 27 Feb 1996 06:27:04 -0600 Organization: Planet Internet Sender: clc@solutions.solon.com Approved: clc@solutions.solon.com Message-ID: <4gutao$i7g@solutions.solon.com> References: <4gq8pl$or2@solutions.solon.com> NNTP-Posting-Host: solutions.solon.com X-Newsreader: Forte Free Agent 1.0.82