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
Lera25 [3.4K]
3 years ago
13

Assume that ip , jp , and tp have all been declared to be pointers to int and that result has been declared to be an array of 10

0 elements . Assume further that ip has been initialized to point to an element in the first half of the array and that jp has been initialized to point to an element in the second half of the array .Write some code that makes jp point to the element that ip was pointing to and that makes ip point to the element that jp was pointing to.Instructor Notes: Here, you are swapping the pointers, not the values they point to.
Computers and Technology
1 answer:
natita [175]3 years ago
3 0

Answer:

The code to this question can be given as:

code:

tp = ip;

ip = jp;

jp = tp;

Explanation:

In this question, it is defined that write code for swapping values that swap the pointers, not the values they point to. So in this code, we assume that all the variable and its value is defined. we simply use the swapping rule that is the first value holds in the new variable and second value hold on the first variable and in the last second variable holds the value of the new variable. In this code, the value will be interchanged or swapped.

You might be interested in
Recursion occurs when a function (calls itself/ calls another function/ calls a function from the python standard library)
lesantik [10]

Answer:

Recursion is calling of a function from within that same function

5 0
2 years ago
Using language c, find the nth Fibonacci, knowing that nth Fibonacci is calculated by the following formula: - If n = 1 Or n = 2
Nina [5.8K]

Answer:

#include <stdio.h>

int fib(int n) {

 if (n <= 0) {

   return 0;

 }

 if (n <= 2) {

   return 1;

 }

 return fib(n-1) + fib(n-2);

}

int main(void) {

 for(int nr=0; nr<=20; nr++)

   printf("Fibonacci %d is %d\n", nr, fib(nr) );

 return 0;

}

Explanation:

The code is a literal translation of the definition using a recursive function.

The recursive function is not per se a very efficient one.

4 0
2 years ago
Write a loop that subtracts 1 from each element in lowerScores. If the element was already 0 or negative, assign 0 to the elemen
Verdich [7]

Answer:

Replace <STUDENT CODE> with

for (i = 0; i < SCORES_SIZE; ++i) {

       if(lowerScores.at(i)<=0){

           lowerScores.at(i) = 0;

       }

       else{

           lowerScores.at(i) = lowerScores.at(i) - 1;

       }  

   }

Explanation:

To do this, we simply iterate through the vector.

For each item in the vector, we run a check if it is less than 1 (i.e. 0 or negative).

If yes, the vector item is set to 0

If otherwise, 1 is subtracted from that vector item

This line iterates through the vector

for (i = 0; i < SCORES_SIZE; ++i) {

This checks if vector item is less than 1

       if(lowerScores.at(i)<1){

If yes, the vector item is set to 0

           lowerScores.at(i) = 0;

       }

       else{

If otherwise, 1 is subtracted from the vector item

           lowerScores.at(i) = lowerScores.at(i) - 1;

       }  

   }

Also, include the following at the beginning of the program:

<em>#include <vector></em>

8 0
2 years ago
What is the legal right granted to all authors and artists that gives them sole ownership and use of their words, software, pict
ICE Princess25 [194]

Answer:

copyright

Explanation:

3 0
3 years ago
Draw the 2-3 tree that results when you insert the keys E A S Y Q U T I O N in that order into an initially empty tree
mr_godi [17]

Answer:

If its any easy question, answer it yourself.

Explanation:

:)

6 0
2 years ago
Other questions:
  • considering that two variables counters and accumulators are important in loop design. What would be their purpose?
    9·1 answer
  • How do I connect my CSS file and HTML page together? it's just not wanting to work for me. 
    5·1 answer
  • What kinds of messages can computers read? (CodeHS)
    7·1 answer
  • When saving a file, you must provide a valid file name that adheres to specific rules, referred to as _______________.
    5·1 answer
  • What is data protection
    13·1 answer
  • If you have a windows 8, but want the features of windows 8 pro, purchase and install _______.
    7·1 answer
  • Any part of the computer that you plug into the CPU like a phone, tablet, headphones etc. are called
    5·1 answer
  • Which of the following is a characteristic of vector graphics?
    15·2 answers
  • An administrator has been asked to update a flow that was created as part of a recent update. When the administrator opens the f
    14·1 answer
  • Which sentence describe internet safety precautions?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!