fork download
  1. #define MAX 20
  2.  
  3. void mergesort(int *,int);
  4. void main()
  5. {
  6. int x[MAX],n,j,i;
  7. char ans;
  8. clrscr();
  9. {
  10. printf("\nEnter The Length Of The Array\t: ");
  11. scanf("%d",&n);
  12. for(i=0;i< n;i++)
  13. {
  14. printf("Enter Element %d\t: ",i+1);
  15. scanf("%d",&x[i]);
  16. }
  17. mergesort(x,n);
  18. printf("\n\t│ Sorted Array :\t\t\t│\n\t│");
  19. for(i=0;i< n;i++)
  20. printf("%d\t",x[i]);
  21. }
  22. printf("│");
  23. getch();
  24. }
  25.  
  26. void mergesort(int x[],int n)
  27. {
  28. int sub[MAX];
  29. int i,j,k,list1,list2,u1,u2,size=1;
  30. while(size< n)
  31. {
  32. list1=0;
  33. k=0;
  34.  
  35. while((list1+size)< n)
  36. {
  37. list2=list1+size;
  38. u1=list2-1;
  39. u2=((list2+size-1)< n)?(list2+size-1):(n-1);
  40.  
  41. for(i=list1,j=list2;i< =u1 &&amp;amp;amp; j< =u2;k++)
  42. if(x[i]< =x[j])
  43. sub[k]=x[i++];
  44. else
  45. sub[k]=x[j++];
  46.  
  47. for(;i< =u1;k++)
  48. sub[k]=x[i++];
  49.  
  50. for(;j< =u2;k++)
  51. sub[k]=x[j++];
  52.  
  53. list1=u2+1;
  54. }
  55. for(i=list1;k< n;i++)
  56. sub[k++] = x[i];
  57. for(i=0;i< n;i++)
  58. x[i] =sub[i];
  59. size *= 2;
  60. }
  61. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
3
compilation info
prog.asm:1: error: label or instruction expected at start of line
prog.asm:3: error: parser: instruction expected
prog.asm:4: error: symbol `void' redefined
prog.asm:4: error: parser: instruction expected
prog.asm:5: error: label or instruction expected at start of line
prog.asm:6: error: comma, colon or end of line expected
prog.asm:7: error: parser: instruction expected
prog.asm:8: error: parser: instruction expected
prog.asm:9: error: label or instruction expected at start of line
prog.asm:10: error: parser: instruction expected
prog.asm:11: error: parser: instruction expected
prog.asm:12: error: parser: instruction expected
prog.asm:13: error: label or instruction expected at start of line
prog.asm:14: error: symbol `printf' redefined
prog.asm:14: error: parser: instruction expected
prog.asm:15: error: symbol `scanf' redefined
prog.asm:15: error: parser: instruction expected
prog.asm:16: error: label or instruction expected at start of line
prog.asm:17: error: parser: instruction expected
prog.asm:18: error: symbol `printf' redefined
prog.asm:18: error: parser: instruction expected
prog.asm:19: error: symbol `for' redefined
prog.asm:19: error: parser: instruction expected
prog.asm:20: error: symbol `printf' redefined
prog.asm:20: error: parser: instruction expected
prog.asm:21: error: label or instruction expected at start of line
prog.asm:22: error: symbol `printf' redefined
prog.asm:22: error: parser: instruction expected
prog.asm:23: error: parser: instruction expected
prog.asm:24: error: label or instruction expected at start of line
prog.asm:26: error: symbol `void' redefined
prog.asm:26: error: parser: instruction expected
prog.asm:27: error: label or instruction expected at start of line
prog.asm:28: error: comma, colon or end of line expected
prog.asm:30: error: parser: instruction expected
prog.asm:31: error: label or instruction expected at start of line
prog.asm:32: error: parser: instruction expected
prog.asm:33: error: parser: instruction expected
prog.asm:35: error: symbol `while' redefined
prog.asm:35: error: parser: instruction expected
prog.asm:36: error: label or instruction expected at start of line
prog.asm:37: error: parser: instruction expected
prog.asm:38: error: parser: instruction expected
prog.asm:39: error: parser: instruction expected
prog.asm:41: error: symbol `for' redefined
prog.asm:41: error: parser: instruction expected
prog.asm:42: error: parser: instruction expected
prog.asm:43: error: comma or end of line expected
prog.asm:45: error: comma or end of line expected
prog.asm:47: error: symbol `for' redefined
prog.asm:47: error: parser: instruction expected
prog.asm:48: error: comma or end of line expected
prog.asm:50: error: symbol `for' redefined
prog.asm:50: error: parser: instruction expected
prog.asm:51: error: comma or end of line expected
prog.asm:53: error: symbol `list1' redefined
prog.asm:53: error: parser: instruction expected
prog.asm:54: error: label or instruction expected at start of line
prog.asm:55: error: symbol `for' redefined
prog.asm:55: error: parser: instruction expected
prog.asm:56: error: expression syntax error
prog.asm:57: error: symbol `for' redefined
prog.asm:57: error: parser: instruction expected
prog.asm:58: error: parser: instruction expected
prog.asm:59: error: parser: instruction expected
prog.asm:60: error: label or instruction expected at start of line
prog.asm:61: error: label or instruction expected at start of line
stdout
Standard output is empty