without changing the main function i need to write the program as described above in subject line. the algoritham to be follwed is also given at last of this forum.

Can anyone give me the exact solution to it

code:

#include <stdio.h>

#include <stdlib.h>

#include <crtdbg.h>

//#include "stack_int.h"

int evalExp( int exp[], int size );

int main ( void )

{

int expList[][35] =

{

{25, 7, '*', 14, '-', 6, '+'},

{1, 24, 3, '+', '*', 41, '-'},

{2, 37, 4, '+', '*', 15, '-'},

{8, 30, 9, '-', 6, '/', '+', 4, '*'}

};

int i;

printf( "\nLAB 3: STACKS\n\n"

"This program is a test driver for Problem 15, Page 142,\n"

"that evaluates postfix expressions.\n\n" );

for( i = 0; i < 4; i++ )

{

printf ("%d\n", evalExp(expList[i], sizeof expList[i]/sizeof(int)));

}

printf( _CrtDumpMemoryLeaks() ? "Memory Leak\n" : "No Leak\n");

return 0;

}

/* =============================================

Evalute a postfix expression

Pre: exp - contains the expression

size - number of elements in the expression

Return: the value of the expression

*/

int evalExp( int exp[], int size )

{

return 0;

}

ALGORITHM:

[IMG]file:///C:/DOCUME%7E1/manan/LOCALS%7E1/Temp/moz-screenshot.png[/IMG]

create Stack

loop ( for each character)

if (its opearand )

push stack ( stack, character)

else

popStack ( stack.op2)

popStack (stack, op1)

operator = character

set value to calculate ( op1,operator, op2)

pushStack (stack,value)

end if

end loop

popStack (Stack,Result)

return (result)

end postFixEvaluate

Can anyone give me the exact solution to it

code:

#include <stdio.h>

#include <stdlib.h>

#include <crtdbg.h>

//#include "stack_int.h"

int evalExp( int exp[], int size );

int main ( void )

{

int expList[][35] =

{

{25, 7, '*', 14, '-', 6, '+'},

{1, 24, 3, '+', '*', 41, '-'},

{2, 37, 4, '+', '*', 15, '-'},

{8, 30, 9, '-', 6, '/', '+', 4, '*'}

};

int i;

printf( "\nLAB 3: STACKS\n\n"

"This program is a test driver for Problem 15, Page 142,\n"

"that evaluates postfix expressions.\n\n" );

for( i = 0; i < 4; i++ )

{

printf ("%d\n", evalExp(expList[i], sizeof expList[i]/sizeof(int)));

}

printf( _CrtDumpMemoryLeaks() ? "Memory Leak\n" : "No Leak\n");

return 0;

}

/* =============================================

Evalute a postfix expression

Pre: exp - contains the expression

size - number of elements in the expression

Return: the value of the expression

*/

int evalExp( int exp[], int size )

{

return 0;

}

ALGORITHM:

[IMG]file:///C:/DOCUME%7E1/manan/LOCALS%7E1/Temp/moz-screenshot.png[/IMG]

create Stack

loop ( for each character)

if (its opearand )

push stack ( stack, character)

else

popStack ( stack.op2)

popStack (stack, op1)

operator = character

set value to calculate ( op1,operator, op2)

pushStack (stack,value)

end if

end loop

popStack (Stack,Result)

return (result)

end postFixEvaluate