MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

Arrays/31_Menu_for_Array.c:500–674  ·  view source on GitHub ↗

Main Function

Source from the content-addressed store, hash-verified

498
499//Main Function
500int main()
501{
502 int i,ch,n,m,x,index;
503 struct array arr,arr2,*arr3;
504 printf("Enter the size of the array: \n");
505 scanf("%d",&arr.size);
506 arr.A=(int*)malloc(arr.size*sizeof(int));
507 arr.length=0;
508 printf("Enter the numner of element you want in the array: \n");
509 scanf("%d",&n);
510 arr.length=n;
511 printf("Enter the elements in the array: \n");
512 for(i=0;i<arr.length;i++)
513 {
514 scanf("%d",&arr.A[i]);
515 }
516 Display(arr);
517
518 do
519 {
520 //Menu Options
521 printf("\n\n************* M E N U *************\n");
522 printf("1. Display\n");
523 printf("2. Append\n");
524 printf("3. Insert\n");
525 printf("4. Delete\n");
526 printf("5. LinearSearch\n");
527 printf("6. LinearSearchSwapToPrev\n");
528 printf("7. LinearSearchSwapToHead\n");
529 printf("8. BinSearch\n");
530 printf("9. RevBinSearch\n");
531 printf("10. Get\n");
532 printf("11. Set\n");
533 printf("12. Max\n");
534 printf("13. Min\n");
535 printf("14. Sum\n");
536 printf("15. Average\n");
537 printf("16. Reverese using a new array\n");
538 printf("17. Reverse using swapping\n");
539 printf("18. Left Shifting\n");
540 printf("19. Right Shifting\n");
541 printf("20. Left Rotation\n");
542 printf("21. Right Rotation\n");
543 printf("22. Insert in Sorted Array\n");
544 printf("23. IsSorted or not\n");
545 printf("24. -ve on left side and +ve on right side\n");
546 printf("25. Merge the intial array with the new array, make sure all the array to be sorted\n");
547
548
549
550 printf("\n\nEnter your choice: \n");
551 scanf("%d",&ch);
552
553 switch(ch)
554 {
555 case 1:
556 Display(arr);
557 break;

Callers

nothing calls this directly

Calls 15

AppendFunction · 0.85
LinearSearchSwapToPrevFunction · 0.85
LinearSearchSwapToHeadFunction · 0.85
BinSearchFunction · 0.85
RevBinSearchFunction · 0.85
Rev1Function · 0.85
Rev2Function · 0.85
lShiftFunction · 0.85
rShiftFunction · 0.85
lRotFunction · 0.85
rRotFunction · 0.85
IsSortFunction · 0.85

Tested by

no test coverage detected