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
Vikki [24]
3 years ago
13

Write a function called printBackwards() that will work with a C string. The function will print any C string backwards. You don

't need to put in the prototype, but you need to write a complete function.
Computers and Technology
1 answer:
yaroslaw [1]3 years ago
8 0

Answer:

void printBackwards(char s[])

{

   int n=strlen(s)-1;//finding the last index of the string..

   for(int i=n;i>=0;i--)//loop to print the string backwards..

   {

       printf("%c",s[i]);//printing the character of the string..

   }

}

Output:-

abcdefg

gfedcba

Explanation:

I have used strlen function that will be used after including the string.h header file.It returns the length of the string.After finding the last index I have iterated over the c string in reverse order and printing the character of the string one by one.

You might be interested in
A presentation on the history of the Internet would mostlikely use the ____ pattern of organizationSpatialproblem-solutionchrono
m_a_m_a [10]

Answer:

topical

Explanation:

A presentation on the history of the Internet would mostlikely use the topical  pattern of organization.

3 0
3 years ago
Use semaphore(s) to solve the following problem. There are three processes: P1, P2, and P3. Each process Pi has a segment of cod
Lisa [10]

Answer:

See explaination

Explanation:

Here we will use two semaphore variables to satisfy our goal

We will initialize s1=1 and s2=1 globally and they are accessed by all 3 processes and use up and down operations in following way

Code:-

s1,s2=1

P1 P2 P3

P(s1)

P(s2)

C1

V(s2) .

P(s2). .

. C2

V(s1) .

P(s1)

. . C3

V(s2)

Explanation:-

The P(s1) stands for down operation for semaphore s1 and V(s1) stands for Up operation for semaphore s1.

The Down operation on s1=1 will make it s1=0 and our process will execute ,and down on s1=0 will block the process

The Up operation on s1=0 will unblock the process and on s1=1 will be normal execution of process

Now in the above code:

1)If C1 is executed first then it means down on s1,s2 will make it zero and up on s2 will make it 1, so in that case C3 cannot execute because P3 has down operation on s1 before C3 ,so C2 will execute by performing down on s2 and after that Up on s1 will be done by P2 and then C3 can execute

So our first condition gets satisfied

2)If C1 is not executed earlier means:-

a)If C2 is executed by performing down on S2 then s2=0,so definitely C3 will be executed because down(s2) in case of C1 will block the process P1 and after C3 execute Up operation on s2 ,C1 can execute because P1 gets unblocked .

b)If C3 is executed by performing down on s1 then s1=0 ,so definitely C2 will be executed now ,because down on s1 will block the process P1 and after that P2 will perform up on s1 ,so P1 gets unblocked

So C1 will be executed after C2 and C3 ,hence our 2nd condition satisfied.

4 0
3 years ago
Do all accounts serve the same function? Why or why not?
lora16 [44]

The correct answer is D. No, accounts serve the purpose that their owners choose.

There are different types of bank accounts which are for saving, fixed deposit account, current account, and recurring account.

Basic banking provides amount of customers with a banking comfort.

They also provide cistomer and secure friendly environment.

3 0
2 years ago
Read 2 more answers
Discard an old computer and want to erase my files
Tamiku [17]
You can use a program like SafeErase to wipe all of your data throughly off your computer. 
7 0
3 years ago
The quicksort is an example of a divide and conquer algorithm in that it divides the sorting problem into smaller problems by di
ankoles [38]

Answer:

The quicksort pivot is an arbitrary element within the collection that is being sorted.  Using the pivot point, the collection of elements is partitioned into two smaller lists of elements.  Using some logic, the smaller elements are placed left of the pivot point, and larger elements are placed to the right of the pivot point.  Ideally, you would prefer you pivot point to be a median of your dataset to optimize the creation of the two sublists into a balanced state.

Cheers.

8 0
3 years ago
Other questions:
  • Which social media marketing concept engages visitors, getting them to revisit your website and tying them to offline events for
    7·2 answers
  • Why is a DNS cache poisoning attack dangerous? Check all that apply. A. Errrr...it's not actually dangerous. B. It allows an att
    12·1 answer
  • Which role is responsible for turning the product backlog into incremental pieces of functionality? bookmark this question
    12·2 answers
  • Someone once observed that "the difference between roles and groups is that a user can shift into and out of roles, whereas that
    13·1 answer
  • For each of the following languages, state with justification whether it isrecognizableor unrecognizable.(a)LHALT≥376={(〈M〉, x)
    10·1 answer
  • Which of these is a popular format for citing sources in academic Works RAM APA CPU or EDU
    10·1 answer
  • Quick!!!!!
    13·2 answers
  • What is a command-line interactive scripting environment that provides the commands for almost any management task in a Windows
    9·1 answer
  • What framework provides a simple API for performing web tasks?
    13·1 answer
  • Create a mobile app plan using PowerPoint slides to show mock-ups of screens,
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!