Skip to content

Commit 83e0db6

Browse files
PritiShawRohitChattopadhyay
authored andcommitted
Priti| insertionSort.c| Edge case addition
1 parent c6b9f4a commit 83e0db6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sorting/Insertion Sort/insertionSort.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ int main(){
3636
// Taking number of Elements in the array from the user
3737
printf("Number of elements: ");
3838
scanf("%d",&NoOfElements);
39+
if(NoOfElements==0){
40+
printf("You entered 0. Nothing to Sort\n");
41+
return 0;
42+
}
3943
arr=(int*)malloc(NoOfElements*sizeof(int));
4044

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

0 commit comments

Comments
 (0)