Terminé

Reverse an array in C with a swap function.

I am teaching myself C online and am trying to complete a question to reverse an array using a specific swap function.

Can someone show me how to do this as I am not able to achieve the outcome I need using a swap function.

Question:

(a). Ask the user to enter 5 integers and store them in an array.

(b). Print the elements stored in the array.

(c). Pass the array and the array size to the swap function which will swap the values in the opposite order.

(d). Print the swapped array in the main function.

I have to use the function prototype below for the swap function, and this is what I am finding difficult.

Function prototype: void swap(int[], int);

An example of the completed output would be the following:

Input 5 numbers:

1

22

3

55

6

Numbers are: 1, 22, 3, 55, 6

After Swapping: 6, 55, 3, 22, 1

Can someone please show how i would solve using the "void swap(int[], int)" function.

Compétences : Programmation C, Architecture Logicielle, Algorithme

Concernant l'employeur :
( 18 commentaires ) Belfast, United Kingdom

Nº du projet : #32282829

Décerné à:

(4 Commentaires)
2.9

10 freelances font une offre moyenne de 19 £ pour ce travail

esa59cfdec1d6569

Hi there, I checked your requirements and guarantee you it's gonna be done within the next few hours. Let's contact via chat so that I can start work immediately. Wish you the best. ------------------------------

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% GBP en 7 jours
(54 Commentaires)
5.2
CodingHelpLine

Hello Sir/Madam I have development experience in various Programming Languages, OOP, Data Structures, Database Driven applications, APIs, Files handling and Data Transformation, ETL and various frameworks. I assure y Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% GBP en 1 jour
(54 Commentaires)
5.1
satyajeetkeshari

Hello Client, I am an expert in C and C++ I have do the array passing in function and sort it. I can start working now. Thanks! Satyajeet

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% GBP en 1 jour
(14 Commentaires)
3.7
novikovyaroslavd

Hi there C++ expert (for over 8 years) here If you hire me you can save your time and money I' m ready to start right now kindly ping me Thanks

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% GBP en 1 jour
(3 Commentaires)
2.0
hfaheemahmed

Just print the array in reverse order. for(i=n;i>=0,i--) print(a[i]); I will do this if you need. With regards, Dr. [login to view URL]

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% GBP en 1 jour
(1 Évaluation)
0.8
Mikrokod

I know C/C++ and I would be glad to help you. I have delivered more than 100 projects. Ask about my portfolio in a private message.

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% GBP en 1 jour
(0 Commentaires)
0.0
vinodselvinnadar

Iam good in c, i can easily solve this type of question easily, you can keep confidence on me. Iam good in c, i can easily solve this type of question easily, you can keep confidence on me.

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% GBP en 1 jour
(0 Commentaires)
0.0
cihanturuncc

I'm one of the best computer engineer. I can do this project cheapest price and no mistakes. If you choose me i m ready to finish the work. My YouTube Channel: [login to view URL]

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% GBP en 1 jour
(0 Commentaires)
0.0
ceanvife

I’m a engineer and former university professor whit thirty years of teaching in programming PC an PLC. I have coded many exercises of programin,I can create the function and comment on it in detail. You can check my c Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% GBP en 1 jour
(0 Commentaires)
0.0