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.
This commit is contained in:
Saumay-Agrawal 2017-02-06 23:03:19 +05:30 committed by GitHub
parent 6f651d147c
commit 03acb2b1ea

View File

@ -7,11 +7,13 @@
#include<stdio.h> #include<stdio.h>
#include<conio.h> #include<conio.h>
#define SIZE 7 #include<stdlib.h>
int main() int main()
{ {
int i,j,temp; int i,j,temp,SIZE;
int arr[ SIZE ]; printf("Enter number of elements to be sorted : ");
scanf("%d",&SIZE);
int *arr = (int*)malloc(SIZE*sizeof(int));
for(i=0; i<SIZE; i++) for(i=0; i<SIZE; i++)
{ {
printf("Enter Number : "); printf("Enter Number : ");