Skip to content

Commit

Permalink
Priti| insertionSort.c| Edge case addition
Browse files Browse the repository at this point in the history
  • Loading branch information
PritiShaw authored and RohitChattopadhyay committed Oct 7, 2020
1 parent c6b9f4a commit 83e0db6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sorting/Insertion Sort/insertionSort.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ int main(){
// Taking number of Elements in the array from the user
printf("Number of elements: ");
scanf("%d",&NoOfElements);
if(NoOfElements==0){
printf("You entered 0. Nothing to Sort\n");
return 0;
}
arr=(int*)malloc(NoOfElements*sizeof(int));

//calling input function which will take elements of array from the user
Expand Down

0 comments on commit 83e0db6

Please sign in to comment.