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.


(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:






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)

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


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)

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)

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)

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)

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)

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)

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)

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)

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)