Skip to content

Commit

Permalink
Revert "fix : selectionsort"
Browse files Browse the repository at this point in the history
This reverts commit de95956.
  • Loading branch information
shubha987 committed Oct 13, 2023
1 parent 5aa1e6d commit 8248294
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions C/selectionSort.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,8 @@ int main() {
printf("Enter the number of elements: ");
scanf("%d", &n);

int *arr = (int *)malloc(n * sizeof(int)); // Dynamically allocate memory
int arr[n];

if (arr == NULL) {
printf("Memory allocation failed.\n");
return 1;
}
printf("Enter %d elements:\n", n);
for (int i = 0; i < n; i++) {
scanf("%d", &arr[i]);
Expand All @@ -48,7 +44,6 @@ int main() {
for (int i = 0; i < n; i++) {
printf("%d ", arr[i]);
}

free(arr);

return 0;
}

0 comments on commit 8248294

Please sign in to comment.