Motivation Initially code was reusable by encapsulating it within functions Example Write void swap (int& firstr int& second) int temp= firsti first second second =temp; Then call swap(x,y); COMP 152Motivation ▪ Initially code was reusable by encapsulating it within functions ▪ Example: • Write • Then call swap(x,y); COMP152 4 void swap (int& first, int& second) { int temp = first; first = second; second = temp; }