From 03acb2b1eaad5a305f4bb35b1e8e4be05dd906e0 Mon Sep 17 00:00:00 2001 From: Saumay-Agrawal Date: Mon, 6 Feb 2017 23:03:19 +0530 Subject: [PATCH] Update BubbleSort.c This program takes the number of elements to be sorted as an input from the user. I think it may be better if we use this. --- BubbleSort.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/BubbleSort.c b/BubbleSort.c index 0621c516..c5b546ce 100644 --- a/BubbleSort.c +++ b/BubbleSort.c @@ -7,11 +7,13 @@ #include #include -#define SIZE 7 +#include int main() { - int i,j,temp; - int arr[ SIZE ]; + int i,j,temp,SIZE; + printf("Enter number of elements to be sorted : "); + scanf("%d",&SIZE); + int *arr = (int*)malloc(SIZE*sizeof(int)); for(i=0; i