Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Data File StructureRSS Feeds

To show the use of stack in function calls

Posted By: Lily Brown     Category: C Programming     Views: 2302

To show the use of stack in function calls.

Code for To show the use of stack in function calls in C Programming

#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <dos.h>

unsigned int far *ptr ;
void ( *p )( void ) ;

void f1( ) ;
void f2( ) ;

void main( )
{
    f1( ) ;
    f2( ) ;

    printf ( "\nback to main..." ) ;
    exit ( 1 ) ;
}

void f1( )
{
    ptr = ( unsigned int far * ) MK_FP ( _SS, _SP + 2 ) ;
    printf ( "\n%d", *ptr ) ;

    p = ( void ( * )( ) ) MK_FP ( _CS, *ptr ) ;
    ( *p )( ) ;
    printf ( "\nI am f1( ) function " ) ;
}

void f2( )
{
    printf ( "\nI am f2( ) function" ) ;
}
  
Share: 

 
 

Didn't find what you were looking for? Find more on To show the use of stack in function calls Or get search suggestion and latest updates.

Lily Brown
Lily Brown author of To show the use of stack in function calls is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!