You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
in Sorting/Bubble Sort/C/BubbleSort.c int arr[] = {6, 4, 5, 8, 2, 1, 9}; int n = sizeof(arr)/sizeof(arr[0]); scanf("%d",&n);<<--- bubbleSort(arr, n);
taking input of n is not a good idea (unless user inputs the elements in the array too). If user enter a large value (larger than the actual size of array) program would print junk values and for sufficiently large value it can also crash the program.
To Reproduce
Steps to reproduce the behavior:
input any large value (larger than the actual size of the array)
Screenshots
The text was updated successfully, but these errors were encountered:
Describe the bug
in Sorting/Bubble Sort/C/BubbleSort.c
int arr[] = {6, 4, 5, 8, 2, 1, 9};
int n = sizeof(arr)/sizeof(arr[0]);
scanf("%d",&n);
<<---bubbleSort(arr, n);
taking input of
n
is not a good idea (unless user inputs the elements in the array too). If user enter a large value (larger than the actual size of array) program would print junk values and for sufficiently large value it can also crash the program.To Reproduce
Steps to reproduce the behavior:
Screenshots
The text was updated successfully, but these errors were encountered: