To find the total number of pieces of candy in the bag (represented by \( p \)), you can set up the equation based on how the candy is distributed among the students.
Since each of the 23 students received 4 pieces of candy, the total number of pieces of candy can be calculated as:
\[ p = 23 \times 4 \]
So, the equation representing the situation is:
\[ p = 23 \cdot 4 \]