Custom Inventory system: void argument not assigned properly?

I’m working on an inventory system and this script is for the equip part of that system. I have five slots to equip items and they work if I equip stuff manually. But now I am trying to write a void to equip them a bit easier. To get there I have this setup:

void Update () {
		if (Input.GetButtonDown("Up")) {
			equipItem (0, ItemType.Cap, cap);
			print (cap.itemID);
		}
}

and the void it self:

public void equipItem (int id, ItemType type, Item slot) {
	for (int i = 0; i < database.items.Count; i++) {
		if (database.items_.itemID == id && database.items*.itemType == type) {*_

_ slot = database.items*;
print (cap.itemID);
print (slot.itemID);
}
}
}*
Print (cap.itemID) returns as -1 (an empty Item) slot.itemID return as 0 (the ID that it is supposed to be). Did I make a mistake assigning the void arguments or is what I am trying to just dumb, and not possible/not the way to do it?
UPDATE: So the problem is that the Item “slot” get’s changed but not the Item “cap” that should have been there in place of the Item “slot”. I got it working by changing the whole void in to an new item, this way i could say cap = equipItem ( 0, itemTyp.Cap); and get what I want for now, problem is I also want to be able to acces this from other scripts.
UPDATE2: Never mind I can just find this script by tagging the object it is attached to._

Paramters are local variables.
Whatever you do to the variable slot within equipItem will not matter outside of it.
You can return a value and assign it to “cap” doing this:

cap = equipItem (0, ItemType.Cap);

and

    public Item equipItem (int id, ItemType type)
    {
      Item slot = null;
      for (int i = 0; i < database.items.Count; i++)
      {
        if (database.items_.itemID == id && database.items*.itemType == type)*_

{
slot = database.items*;*
print (cap.itemID);
print (slot.itemID);
}
}
return slot;
}