Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Commit

Permalink
Merge pull request #7 from SupulCFG/sorting_algorithms
Browse files Browse the repository at this point in the history
Changed array from Stack to Heap
  • Loading branch information
SupulCFG authored Oct 19, 2021
2 parents aef0599 + abfde81 commit f4d2778
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Search Algorithms/Linear Search/Linear Search.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ int main(){
exit(-1);
}

int arr[size]; // for demonstration purposes only!,
// it's better to use heap (malloc) when dealing with variable array sizes rather than implementing on Stack

int *arr = malloc(size * sizeof(int)); // we should always define a variable size array on heap, because


for(i=0;i<size;i++)
Expand Down

0 comments on commit f4d2778

Please sign in to comment.