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
topjm [15]
3 years ago
8

What is the output from this program? #include void do_something(int *thisp, int that) { int the_other; the_other = 5; that = 2

+ the_other; *thisp = the_other * that; } int main(void) { int first, second; first = 1; second = 2; do_something(&second, first); printf("%4d%4d/n", first, second); return (0); }
Computers and Technology
1 answer:
Ostrovityanka [42]3 years ago
7 0

Answer:

  1  35

Explanation:

* There is a little typo in printf. It should be "\n".

Initially, the value of the first is 1, and the value of the second is 2. Then, do_something(&second, first) is called. The value of the <em>first</em> will still be 1. However, there is a call by reference for <em>second </em>variable. That means the change made by the function <em>do_something</em> will affect the value of the <em>second</em> variable.

When you look at the calculation inside the <em>do_something</em> function, you may see that value of the <em>second</em> will be 35.

You might be interested in
Write a script that calculates the common factors between 8 and 24. To find a common factor, you can use the modulo operator (%)
AnnyKZ [126]

Answer:

  1. common = []
  2. num1 = 8
  3. num2 = 24
  4. for i in range(1, num1 + 1):
  5.    if(num1 % i == 0 and num2 % i == 0):
  6.        common.append(i)
  7. print(common)

Explanation:

The solution is written in Python 3.

Firstly create a common list to hold a list of the common factor between 8 and 24 (Line 1).

Create two variables num1, and num2 and set 8 and 24 as their values, respectively (Line 3 - 4).

Create a for loop to traverse through the number from 1 to 8 and use modulus operator to check if num1 and num2 are divisible by current i value. If so the remainder of both num1%i and num2%i  will be zero and the if block will run to append the current i value to common list (Line 6-8).

After the loop, print the common list and we shall get [1, 2, 4, 8]

8 0
3 years ago
Write a class named Taxicab that has three **private** data members: one that holds the current x-coordinate, one that holds the
Licemer1 [7]

Answer:

See explaination

Explanation:

class Taxicab():

def __init__(self, x, y):

self.x_coordinate = x

self.y_coordinate = y

self.odometer = 0

def get_x_coord(self):

return self.x_coordinate

def get_y_coord(self):

return self.y_coordinate

def get_odometer(self):

return self.odometer

def move_x(self, distance):

self.x_coordinate += distance

# add the absolute distance to odometer

self.odometer += abs(distance)

def move_y(self, distance):

self.y_coordinate += distance

# add the absolute distance to odometer

self.odometer += abs(distance)

cab = Taxicab(5,-8)

cab.move_x(3)

cab.move_y(-4)

cab.move_x(-1)

print(cab.odometer) # will print 8 3+4+1 = 8

7 0
2 years ago
Read the excerpt below and answer the question.
zysi [14]

Answer:

Agreed

Explanation:

8 0
3 years ago
Match each item with a statement below. - A parameter in a method header. - A set of methods that can accept a call given the pa
Bas_tet [7]

Answer:

                                 

Explanation:

6 0
3 years ago
I'm bor.ed so... here's my em.ail
Nataly [62]

Thank you for your email

6 0
2 years ago
Other questions:
  • This question involves the implementation of the PasswordGenerator class, which generates strings containing initial passwords f
    5·1 answer
  • This operating system was used by individual computers and required users to type commands.
    9·1 answer
  • On sites that use "cloud computing," how is your information being stored?
    13·1 answer
  • What paper should I use for technical drawing?
    14·1 answer
  • The measure of the maximum amount of data that can travel through a computer’s communications path in a given amount of time is
    9·1 answer
  • graphic designers can compress files in different formats . One of the formats ensures that the quality and details of the image
    7·1 answer
  • Describe two types of software suites supporting your answer with three examples each.
    12·1 answer
  • True or False? A website for a certain political party or candidate is likely to have unbiased information.
    11·2 answers
  • What was the strategy the company adopted for ERP implementation?
    12·1 answer
  • What is a system of access control that allows only limited use of material that has been legally purchased?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!