C By Discovery (4th Edition)

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 1320 – Section 001 Midterm 2 (Practice A) Name:_____________________________________________________Grade: ___________ [100pts] 1. Write a function void append_reverse(char *str) that appends a reverse copy of a string str to itself. The reverse copy of a string str is a string with the same characters in reverse order. For example, the reverse copy of the string “CSE1320” is “0231ESC”. Therefore, the append_reverse function will concatenate the reverse copy to the string itself and change the string str to “CSE13200231ESC”. You may assume that the string str has enough space to append the reverse copy. [20 pts] void append_reverse(char *str) { int ind, last; ind = 0; while (str[ind] != ‘\0’) ind++; last = ind; ind--; while (ind >= 0) str[last++] = str[ind--]; str[last] = ‘\0’; } 2. Given an array numbers of n integers, write the function void divide(int numbers[], int n) that prints all pairs ( x 1, x 2) of integers x 1 and x 2 in the array numbers , such that
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/06/2011 for the course CSE 1320 taught by Professor Sprintston during the Spring '08 term at UT Arlington.

Page1 / 3

Practice2A - CSE 1320 Section 001 Midterm 2(Practice A...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online