Skip to content

Commit

Permalink
Fixed update bug
Browse files Browse the repository at this point in the history
  • Loading branch information
landiluigi746 committed May 6, 2024
1 parent 9aa5e4c commit 885edb2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/manager/update.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* The function first searches for the account in the array and then
* if the user is found, prompts the user to select which account to
* update and which field of the account to update.
* In the end the accounts are sorted again.
*
* @param accounts The accounts where to search
* @param currentAccounts The number of accounts
Expand All @@ -13,7 +14,7 @@
*/
void updateAccount(Account* accounts, size_t currentAccounts, const char* username, size_t* occurrences)
{
int searchResult = searchAccount(accounts, currentAccounts, username, occurrences);
int i, searchResult = searchAccount(accounts, currentAccounts, username, occurrences);
size_t choice, index;

if(searchResult == NOT_FOUND)
Expand Down Expand Up @@ -58,5 +59,8 @@ void updateAccount(Account* accounts, size_t currentAccounts, const char* userna
}
} while(choice <= 0 || choice > 3);

sort(accounts, sizeof(Account), currentAccounts, &compareAccountsGeneral, ASCENDING);

pause();
return;
}

0 comments on commit 885edb2

Please sign in to comment.