I use dictionaries, but you can use an array too.
You can create a system that will need a couple of global variables and at least one dictionary.
Lets say you have two weapons. Create a global variable called weaponState with default value 1 and another global variable called ammoEquipped. weaponState will only ever be 1 or 2, and ammoEquipped contains the ammo for the currently equipped weapon.
In the dictionary set two keys called ammo1 and ammo2 each with value 100.
By default player has weapon 1 selected, so weaponState = 1.
When player fires a bullet subtract 1 from ammoEquipped.
When player presses keyboard key 2, the value from ammoEquipped is set to dictionary key ammo1, weaponState is set to 2, the value from dictionary key 'ammo2' is loaded into ammoEquipped.
When weapon is changed by pressing key 1 or 2 on keyboard, you can also switch animations in player sprite to visually show which weapon is equipped.
Heres a simple example to point you in the right direction weaponSystemBasic_artpunk.c3p