/******************************************* Engineering 3891 Advanced Structured Programming Assignment: 3 Date Due: October 5th/2000 Name: Daryl Martin Student #: 9713520 Username: darylm ********************************************/ #include "assign3.h" /****************************************************************** * strDup -- Copy the string in the source array to the dest array. * * Parameters: * *dest -- The destination string (output) * *source -- The origonal string (input) * * Modifies: none * * Returns: A copy of a string Date: 10/05/00 *******************************************************************/ void strDup(char *dest, const char *source) { while (*source) *dest++ = *source++; //Copy's the string to dest location } /****************************************************************** * strCat -- Add the source string to the end of the dest string. * * Parameters: * *dest -- The destination string (output) * *source -- The origonal string (input) * * Modifies: none * * Returns: two strings combined Date: 10/05/00 *******************************************************************/ void strCat(char *dest, const char *source) { while (*dest) dest++; //goes to the end of the string dest while (*source) *(dest++) = *(source++); //Add's source to the string dest } /****************************************************************** * strRev -- Reverses the string IN PLACE. e.g. "the" would become "eht" * and "function" would become "noitcnuf" * Parameters: * *theString -- The origonal string (input) * * Modifies: none * * Returns: The string reversed Date: 10/05/00 *******************************************************************/ void strRev(char *theString) { int count=0; //make variable count char temp; //make a temporary character temp while (*(theString+count)) count++; // Counts the number of characters for(int i = 1; i <= (count/2); i++) { temp = theString[i-1]; //loads this value into temp theString[i-1] = theString[count-i]; theString[count-i] = temp; //set's count-i to temp } return; }