1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lozanna [386]
3 years ago
13

Write a function called reverse() with this prototype:

Computers and Technology
1 answer:
tresset_1 [31]3 years ago
4 0

Answer:

void reverse(char dest[], char source[], int size)

{

   for(int i=0;i<size;i++)//using for loop.

   {

       dest[i]=source[i];//assigning each element of source array to dest array.

   }

   int s=0,e=size-1;//initializing two elements s with 0 and e with size -1.

   while(s<e){

       char t=des[s];             //SWAPPING

       dest[s]=dest[e];            //SWAPPING

       dest[e]=t;                  //SWAPPING

       s++;

       e--;

   }

}

Explanation:

I have used while loop to reverse the array.I have initialize two integer variables s and e with 0 and size-1.Looping until s becomes greater than e.

It will work as follows:

first s=0 and e=0.

dest[0] will be swapped with dest[size-1]

then s=1 and e=size-2.

then des[1] will be swapped with dest[size-2]

and it will keep on going till s is less than e.

You might be interested in
When command is transferred, the process should include a(n): A. Detailed Lesson Learned Report B. Intelligence Report C. Award
mojhsa [17]

Answer:

Briefing

Explanation:

The Incident Command System (ICS) is a management system designed to enable effective and efficient domestic incident management by integrating a combination of facilities, equipment, personnel, procedures, and communications operating within a common organizational structure. ICS is normally structured to facilitate activities in five major functional areas: command, operations, planning, logistics, Intelligence & Investigations, finance and administration. It is a fundamental form of management, with the purpose of enabling incident managers to identify the key concerns associated with the incident—often under urgent conditions—without sacrificing attention to any component of the command system.

3 0
3 years ago
Read 2 more answers
Write an application that inputs three numbers (integer) from a user. (10 pts) UPLOAD Numbers.java a. display user inputs b. det
SCORPION-xisa [38]

Answer:

The program to this question as follows:

Program:

import java.util.*; //import package for user input

public class Number //defining class Number

{

public static void main(String[] ak)throws Exception //defining main method

{

int a1,b1,c1; //defining integer variable

int p_Count=0,n_Count=0,n_Zero=0,even_Count=0,odd_Count=0;

Scanner obx=new Scanner(System.in); //creating Scanner class object

System.out.println("Input all three numbers: "); //print message

//input from user

a1=obx.nextInt(); //input value

b1=obx.nextInt(); //input value

c1=obx.nextInt(); //input value

//check condition for a1 variable value

if(a1>0) //positive number

p_Count++;

else if(a1==0) //value equal to 0

n_Zero++;

else //value not equal to 0

n_Count++;

if(a1%2==0)//check even number

even_Count++;

else //for odd number

odd_Count++;

//check condition for b1 variable value

if(b1>0) //positive number

p_Count++;

else if(b1==0) //value equal to 0

n_Zero++;

else //value not equal to 0

n_Count++;

if(b1%2==0) //check even number

even_Count++;

else //for odd number

odd_Count++;

//check condition for c1 variable value

if(c1>0) //positive number

p_Count++;

else if(c1==0) //value equal to 0

n_Zero++;

else //value not equal to 0

n_Count++;

if(c1%2==0) //check even number

even_Count++;

else //for odd number

odd_Count++;

//print values.

System.out.println("positive number: "+p_Count);//message

System.out.println("negative number: "+n_Count); //message

System.out.println("zero number: "+n_Zero); //message

System.out.println("even number: "+even_Count); //message

System.out.println("odd number: "+odd_Count); //message

}

}

Output:

Input all three numbers:

11

22

33

positive number: 3

negative number: 0

zero number: 0

even number: 1

odd number: 2

Explanation:

In the above java program code a class is defined in this class three integer variable "a1,b1, and c1" is defined which is used to take input value from the user end, and other integer variable "p_Count=0, n_Count=0, n_Zero=0, even_Count=0, and odd_Count=0" is defined that calculates 'positive, negative, zero, even, and odd' number.

  • In the next step, the conditional statement is used, in if block a1 variable, b1 variable, c1 variable calculates it checks value is greater then 0, it will increment the value of positive number value by 1.
  • else if it will value is equal to 0. if this condition is true it will negative number value by 1
  • else it will increment zero number values by 1.
  • In this code, another if block is used, that checks even number condition if the value matches it will increment the value of even number by 1, and at the last print, method is used that print all variable values.
7 0
3 years ago
Does Android have text-to-voice?
Licemer1 [7]
Yes but its nothing compared to apple
6 0
4 years ago
What might the purpose be for a sata-style power connector on a motherboard?
kozerog [31]
To power a storage device (HDD, SSD)
4 0
3 years ago
What is an Array? 20 POINTS!!!
EastWind [94]

Answer:

I'm about 99% sure it's C: a unique address or location un the collection

6 0
2 years ago
Other questions:
  •  When using cost-benefit analysis to determine the benefits of a community project, economists measure the value in terms of (A.
    14·1 answer
  • Describe two ways the ARPANET is different from the internet
    12·1 answer
  • (The Location class) Design a class named Location for locating a maximal value and its location in a two-dimensional array. The
    10·1 answer
  • An Internet connection problem for customers is found to be outside a carrier's regional office. As a result, which area needs t
    9·1 answer
  • To add another worksheet to an Excel file, click on the _____
    15·1 answer
  • A researcher wants to do a web-based survey of college students to collect information about their sexual behavior and drug use.
    7·1 answer
  • We need ____ pointers to build a linked list.
    6·1 answer
  • Please Help!! How to code this in Python?
    11·1 answer
  • A citizen of any group has both _____ and _____.
    10·1 answer
  • A user may enter some text and the number of times (up to a maximum of 10) to repeat it. Display the text repeated that many tim
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!