fork download
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<string.h>
  4. int maxsize=100;
  5. static char arr[100];
  6. int top=-1;
  7. char queue[100];
  8. int front=-1;
  9. int rear=-1;
  10. char enqueue(char data){
  11. if(rear+1>=100){
  12. return 0;}
  13. else{
  14. queue[rear+1]=data;
  15. rear++;
  16. return 1;
  17. }}
  18. char dequeue(){
  19. if(front==rear){
  20. return 0;}
  21. else{
  22. char data=queue[front+1];
  23. front++;
  24. return(data);
  25. }}
  26.  
  27. int push(char new){
  28.  
  29. top++;
  30. arr[top]=new;
  31. return 0;
  32. }
  33. char pop(){
  34.  
  35. char tmp;
  36.  
  37. top--;
  38. return (arr[top+1]);
  39. }
  40. int main(){
  41. int t=1;
  42. int f=0;
  43. int k;
  44. char stack[10];
  45. char queue[10];
  46.  
  47. char aa[100];
  48. int stringsize=strlen(aa);
  49.  
  50. int i;
  51. int counter=0;
  52. int n;
  53. scanf("%d\n",&counter);
  54. for(k=0;k<=counter;k++){
  55. i=0;
  56. scanf("%c\n",aa);
  57. while(i<stringsize){
  58.  
  59.  
  60. push(aa[i]);
  61. enqueue(aa[i]);
  62. i++;}
  63. n=0;
  64. while(n<stringsize){
  65. stack[n]=pop();
  66. queue[n]=dequeue();
  67. if(stack[n]==queue[n]){
  68.  
  69.  
  70. n++;}
  71. else
  72. {
  73. printf("%d\n",f);
  74.  
  75. }
  76. }
  77. if(stack==queue){
  78. printf("%d\n",t);
  79. }
  80. }
  81. return 0;
  82.  
  83. }
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
cc1: warnings being treated as errors
prog.c: In function ‘pop’:
prog.c:35: error: unused variable ‘tmp’
stdout
Standard output is empty