Guest User

Untitled

a guest
Dec 11th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include<stdio.h>
  2. void push(char m);
  3. void pop();
  4. int i, top=-1;
  5. char s[20];
  6. void main()
  7. {
  8. char a[]="(sangeet(h))";
  9. i=0;
  10. push('#');
  11. while(a[i++]!='\n')
  12. {
  13. if(a[i]==')')
  14. {
  15. pop();
  16. }
  17. if(a[top]=='#')
  18. printf("valid");
  19. else
  20. printf("invalid");
  21. }
  22. void push(char m)
  23. {
  24. top++;
  25. s[top]=m;
  26. }
  27. void pop()
  28. {
  29. --top;
  30. }
Add Comment
Please, Sign In to add comment