![]() |
|
#1
|
|||
|
|||
Reverse of 2 arraysHi I am having trouble getting the exact code for this problem." Write the definition of a function, isReverse , whose first two parameters are arrays of integers of equal size, and whose third parameter is an integer indicating the size of each array. The function returns true if and only if one array is the reverse of the other. ("Reverse" here means same elements but in reverse order.) "
This is what I have right now: CPP / C++ / C Code:
Can someone tell me what I am doing wrong??? Last edited by LuciWiz : 18-Nov-2008 at 02:14.
Reason: Please insert your C++ code between [cpp] & [/cpp] tags
|
|||
|
#2
|
|||
|
|||
Re: reverse of 2 arraysYou are only examining the first element of the for loop and then exiting.
It is more likely you would want to return false on failure within the loop otherwise return true as all things matched. For example CPP / C++ / C Code:
__________________
My personal site: Utilities for text processing, debugging, testing and plotting |
|
#3
|
||||
|
||||
Re: reverse of 2 arraysIf c is the size of the arrays, it should be
CPP / C++ / C Code:
__________________
www.blake-foster.com |
|
#4
|
|||
|
|||
Re: Reverse of 2 arraysYes. My apologies. Indexing should always end at size - 1 if the array is zero based.
__________________
My personal site: Utilities for text processing, debugging, testing and plotting |
Recent GIDBlog
Toyota - 2009 May Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need Help with input files. | Efferus | C++ Forum | 2 | 24-Nov-2007 17:19 |
| Reverse DNS entries | admin | Web Hosting Forum | 1 | 21-Apr-2006 11:39 |
| Reverse functions and Reverse checking functions | jenmaz | C Programming Language | 4 | 24-Nov-2004 09:48 |
| I am reviewing Arrays and need help converting some strings to arrays | jenmaz | C Programming Language | 22 | 23-Nov-2004 00:26 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The