Search Results

Search found 3 results on 1 pages for 'muhammadlodhi'.

Page 1/1 | 1 

  • Without LIB And String file how can i write this code??

    - by muhammadlodhi
    #include<stdio.h> #include<conio.h> #include<stdlib.h> #include<string.h> struct Node; typedef struct Node * PtrToNode; struct Node { char element; PtrToNode Next; }; PtrToNode MakeEmpty(PtrToNode L) { L= new(Node); L->Next=NULL; return L; } void Push(PtrToNode L,char x) { PtrToNode S; S= new(Node); S->element=x; S->Next=L->Next; L->Next=S; } char Pop(PtrToNode L) { PtrToNode P; P=L->Next; char x=P->element; L->Next=P->Next; free(P); return x; } int main() { PtrToNode L; L= MakeEmpty(NULL); char Input[1000]; int i; printf("please enter your equation:"); scanf("%s",Input); for (i = 0;i<strlen(Input);i++) { if (Input[i]=='(') { Push(L,Input[i]); } if (Input[i]==')') { if (L->Next==NULL) { printf("incorrect"); return 0; } else Pop(L); } } if (L->Next==NULL) printf("correct"); else printf("incorrect"); getch(); return 0; }

    Read the article

1