/*Linked List Implementation of STACK*/
/*Checking of parenthesis in expressions*/
#include<conio.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define M 100
typedef struct node *nd;
struct node
{
char p;
nd next;
}NODE;
void getExpression(char expr[]);
void checkParenthesis(char expr[],int *);
void dispResult(int);
nd top,bottom;
int main(void)
{
char expr[M];
int r;
getExpression(expr);
checkParenthesis(expr,&r);
dispResult(r);
return 0;
}
void getExpression(char expr[])
{
clrscr();
printf("Input an expression: ");
gets(expr);
}
void checkParenthesis(char expr[],int *r)
{
int f=0,l,i;
char e;
nd tp,t;
top = NULL;
bottom = NULL;
l = strlen(expr);
for(i=0;i<l;i++)
{
e=expr[i];
if(e == '(')
{
tp = malloc(sizeof(NODE));
tp->p=e;
if((top==NULL) && (bottom==NULL))
{
tp->next = NULL;
top = tp;
bottom = tp;
}
else
{
tp->next=top;
top=tp;
tp=NULL;
}
}
else if(e==')')
{
if(top==bottom)
{
if(top==NULL)
{
f=1;
break;
}
else
{
top=NULL;
bottom=NULL;
}}
else
{
t=top;
top=top->next;
t->next=NULL;
}
}
}/*end of for loop*/
if(top != NULL)
f=1;
*r=f;
}/*end of function checkParenthesis*/
void dispResult(int r)
{
clrscr();
if(r==0)
printf("The expression has a balance parentheses.");
else if(r>0)
printf("Unbalanced parentheses.");
getch();
}
/*
if(top==bottom)
{
top=NULL;
bottom=NULL;
}
else
{
if((top==NULL)&&(bottom==NULL))
{
f=1;
break;
}
else
{
t =top;
top = top->next;
t->next = NULL;
}
}
}
*/
/*eahjie*/
Yes, you can use for-loop in a C program compiled by Turbo C.
Editor - edits text Compiler - compiles the program Linker - links the program Debugger - helps finding bugs
Turbo c program is from Borland which is an integrated development environment and a computer language. Some of the parts of turbo c were incorporated from the wizard c in 1987, but it was first developed by Dennis Ritchie in 1970.
Turbo Pascal is a style of computer programming. This type of writing language can be used to create a program that prints the alphabet backwards.
No idea what mother program is, but I assume you mean how does Turbo C++ compare to the ISO C++ standard. The last version of Turbo C++ came out in 2006 and was compliant with the standard at that time. However, Embarcadero (the current owners) no longer support Turbo C++, thus it no longer complies with the current ISO standard.
Yes, you can use for-loop in a C program compiled by Turbo C.
tagprice
Turbo c3 or Turbo c4. R.P. Hammad Khan_Haider...
1. Turbo C is an example of Integrated Developing Environment. 2. Turbo C has example programs, the most important is bgidemo.c
Editor - edits text Compiler - compiles the program Linker - links the program Debugger - helps finding bugs
With program DosBox,
File/Open
Turbo c program is from Borland which is an integrated development environment and a computer language. Some of the parts of turbo c were incorporated from the wizard c in 1987, but it was first developed by Dennis Ritchie in 1970.
They are example programs written in Turbo Pascal.
Eric P. Bloom has written: 'The Turbo C++ trilogy' -- subject(s): C (Computer program language), C++ (Computer program language), Turbo C (Computer file), Turbo C++ 'Turbo C Plus Plus Trilogy' 'The C trilogy' -- subject(s): C (Computer program language)
Turbo Pascal is a style of computer programming. This type of writing language can be used to create a program that prints the alphabet backwards.
BGIDEMO.C is an example.