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
Katena32 [7]
3 years ago
5

For the following code, if the input is negative, make numitemsPointer be null. Otherwise, make numitemsPointer point to numitem

s and multiply the value to which numitems Pointer points by 10.
Ex: If the user enters 99, the output should be: Items: 990
Code :
#include
int main(void) {
int* numItemsPointer;
int numItems;
scanf ("%d", &numItems);

/* Your solution goes here */

if (numItems Pointer == NULL) {
printf ("Items is negative\n");
}
else { printf("Items: %d\n", *numItemsPointer);
}
return 0;
}
Computers and Technology
2 answers:
weeeeeb [17]3 years ago
7 0

Answer:

The program to this question can be described as follows:

Program:

#include <stdio.h> //defining header file  

int main() //defining main method

{

int* numItemsPointer; //defining pointer variable

int numItems; //defining integer variable

scanf ("%d", &numItems); //input value from user end

if(numItems < 0) //defining if block to check value

{

   numItemsPointer = NULL; //assign value to null

   printf ("Items is negative\n"); //print message

}

else //else block

{

   numItemsPointer = &numItems; //holds address

   numItems = numItems * 10; //multiple by 10

   printf("Items: %d\n", *numItemsPointer); //print value

}

return 0;

}

Output:

99

Items: 990

Explanation:

In the above program two integer variable "numItemsPointer and numItems" is defined, in which numItemsPointer is a pointer variable and numItems is integer variable, in which we input value from the user end, and an if condition statement is used, that check and calculate the values, which can be described as follows:

  • In the if block a condition is defined that variable "numItems" is less then 0, if this condition is true so, inside the block, it will assign a value, that is equal to "NULL", and prints its value.
  • If the condition is not true it will go to the else block, in this block, it will first pointer variable holds the variable address, and multiply the value by 10, and prints pointer variable value.
77julia77 [94]3 years ago
3 0

Answer:

hi

Explanation:

You might be interested in
Which heading function is the biggest?<br> 1. h1<br> 2. h2<br> 3. h3
sattari [20]

Answer:

h3

Explanation:

sub to Thicc Panda on YT

6 0
3 years ago
Read 2 more answers
What is a distraction that you find when photographing animals at the zoo
yaroslaw [1]

D. All of the above.

<u>Reason:</u>

A. Fences can get in the way of a beautiful picture.

B: The animal's enclosure may be hard to get the perfect snap. Like a rock can be in the way of the animal. idk...lol

C. People want to see the animal as much as you do so they may block the way of a picture.

Example from Google..XD


7 0
3 years ago
What information is displayed in the message header of a received message? Check all that apply.
Aleks04 [339]

Answer:

the subject of the message

the sender's name

the recipient's name

the date and time when the message was received

Explanation:

Various information is displayed in the header of the message of a received message. And they are the subject of the message, which briefs what is there inside the message. And it mentions the sender's name as well as the recipient's name, and finally, the date and the time as well are stated that explains exactly when the message was being received. And all this information is shown in the header of the message.

3 0
3 years ago
You can access various sites on the WWW by using hyperlinks or by
Tresset [83]
Or by searching up the desired content and or information on a search engine. I believe.
5 0
3 years ago
Jacob would like to include an arrow in his newsletter to point to some important information. He should _____.
qwelly [4]

Some people either add a shape as I do. But for this particular question it would be, either add word art or create a list with bullets. I would rather do word art or insert shape because that means you do not have to get the single bullet.


I really do hope this helped you. I hope you have a great day. And if I am incorrect I apologize.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Using the flowchart below, what value when entered for Y will generate a mathematical error and prevent our flowchart from being
    14·1 answer
  • What type of firestopping technology expands as much as 25 times in volume?
    6·1 answer
  • Macy reviewed Steve's presentation. Images in the slides were distracting from the presentation. What advice should
    7·2 answers
  • Which scenario depicts an ethical workplace practice by a business owner? A. sharing personal information of its employees with
    8·2 answers
  • _____ provide a description of the data characteristics and the set of relationships that link the data found within the databas
    8·1 answer
  • The incompatibilities in speed between the various devices and the CPU make I/O synchronization difficult, especially if there a
    6·1 answer
  • Please help me I need a help
    13·1 answer
  • ☢☢☢does anyone know how to do the TYNKER CANNON assignment ( lesson 2 intro to game design) I'll give BRANLIEST(¬‿¬)❤ dont answe
    11·2 answers
  • Discuss the impact printer and its types in detail?
    7·1 answer
  • Write a sub-program to display the acceleration of car. The program should ask initial velocity, final velocity, and time taken
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!