The Z button refers to the long, purple button at the top right corner of a GameCube controller; the rectangular, gray trigger located on the back of a Nintendo 64 controller; or the rectangular, white button on the back of the Nunchuk. It can also refer to the two circular white buttons on the top of the Classic controller called the ZL and ZR buttons. There is no Z button on the Wii remote. On the GameCube and Classic controllers, the purpose of the Z button is to grab opponents. On the Nunchuk and Nintendo 64 controllers, the Z button is used to shield.
In terms of Super Smash Bros. Brawl's programming, the Z button on the GameCube controller is considered to be both a shield button and a standard attack button at the same time. This is known because nowhere in character movesets does the game check to see if a grab button has been pressed - it only checks for if a shield and an attack button have been pressed simultaneously. This explains why the Z button can execute both attack-based functions (natural combo continuations, smash charging) and shield-based functions (air dodging). This may be the case for the other two games as well.
Controllers and buttons
|Nintendo 64 controller|
|Wii Remote (and Nunchuk)||·|