473,378 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

array reversal in C programming

I am working on a "mini" assignment for a programming class.
This is the problem...


Reversing the elements of an array involves swapping the corresponding elements of the array: the first with the last, the second with the next to the last, and so on, all the way to the middle of the array.

Given an array b , an int variable z containing the number of elements in b , and two other int variables, i and hold , write a loop that reverses the elements of the array.

Do not use any other variables besides b , z , i , and hold.

I tried a for loop with no success. Any help would be great!

Thanks in advance.
Nov 3 '06 #1
0 1878

Sign in to post your reply or Sign up for a free account.

Similar topics

24
by: ineedyourluvin1 | last post by:
Why does this reverse the string ? Sorry about using namespace std ; It made it easier to read :-) Thanks #include<iostream> using namespace std ; void rev_str( char* str ) {
11
by: Tosha | last post by:
What is the fastest way to convert __int64 type from BigEndian To Little Endian? I wrote this function: --- uint64 EndianReverse(uint64 number) { typedef unsigned __int8 uint8; const int size =...
25
by: Frederick Gotham | last post by:
I was intrigued by someone the other day who posted regarding methods of "mirror-imaging" the bits in a byte. I thought it might be interesting to write a fully-portable algorithm for...
8
by: gsl | last post by:
Can anyone tell me how to reverse an integer number represented in binary form(or we can say binary reversal of int)? for ex: given 101100 .... the answer should be 001101
7
by: s88 | last post by:
Hi all: I have a memory area fill will 0x90(NOP). This area is allocated by the linker. I want to transfer this area into a char array. I have already known the size of this area and the beginning...
14
by: Abhi | last post by:
I wrote a function foo(int arr) and its prototype is declared as foo(int arr); I modify the values of the array in the function and the values are getting modified in the main array which is...
3
by: steezli | last post by:
Hi, Brand new to VB.NET and I'm having a problem figuring out this program. I'll try and be descritive as possible. I have to create a Windows application that contains a single top-level...
4
by: Ravi4raj | last post by:
Hi all, Here i have to know is thr any way to sort the array according to thr Bit Reverse.. for Example: If we take the Array size of 256,then the Sorting Should be like below. a =...
36
by: pereges | last post by:
Hi, I am wondering which of the two data structures (link list or array) would be better in my situation. I have to create a list of rays for my ray tracing program. the data structure of ray...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.