subject

Implement a small program that defines a regular number type variable, and a pointer variable to the same type of number. Create these variables before starting steps 1-11 below. Only one regular variable and one pointer variable should be created for this assignment. Use these variables for the following tasks (be sure to label each of these tasks, using comments):
1) ask the user for a value and store it in the regular variable
2) make the pointer variable point to the regular variable location
3) use both the regular variable and pointer variable to print the VALUE stored and the ADDRESS the value is stored at (four things should be printed, some will be the same)
4) use the pointer variable to allocate memory for a single value
5) store a value into this newly allocated memory
6) print the same items as in step 3 (print the original value & address as well as the newly allocated value and address)
7) deallocate the memory allocated in step 5
8) ask the user for a small number and use the pointer variable to allocate memory for an array of that size of the appropriate number type
9) store random values in all elements of this newly allocated array (use array notation)
10) print all elements of the array (use array notation)
11) deallocate any allocated memory and end the program
The files must be named lab7.cpp. Put your name and the file name as the first two (commented) lines in the file.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 01:30
Jason works as an accountant in a department store. he needs to keep a daily record of all the invoices issued by the store. which file naming convention would him the most? a)give the file a unique name b)name the file in yymmdd format c)use descriptive name while naming the files d)use capital letters while naming the file
Answers: 3
question
Computers and Technology, 23.06.2019 03:10
Fill in the following program so that it will correctly calculate the price of the orange juice the user is buying based on the buy one get one sale.#include //main functionint main() { int cartons; float price, total; //prompt user for input information printf("what is the cost of one container of oj in dollars? \n"); scanf(" [ select ] ["%d", "%c", "%f", "%lf"] ", & price); printf("how many containers are you buying? \n"); scanf(" [ select ] ["%d", "%c", "%f", "%lf"] ", & cartons); if ( [ select ] ["cartons / 2", "cartons % 1", "cartons % 2", "cartons % price", "cartons / price", "cartons / total"] [ select ] ["=", "==", "! =", "< =", "> =", "< "] 0) total = [ select ] ["price * cartons", "cartons * price / 2 + price", "(cartons / 2) * price", "cartons / (2.0 * price)", "(cartons / 2.0) * price + price", "((cartons / 2) * price) + price"] ; else total = ((cartons / 2) * price) + price; printf("the total cost is $%.2f.\n", total); return 0; }
Answers: 2
question
Computers and Technology, 23.06.2019 14:00
Need ! will choose brainliest! discuss the role of abstraction in the history of computer software.
Answers: 1
question
Computers and Technology, 24.06.2019 01:30
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
You know the right answer?
Implement a small program that defines a regular number type variable, and a pointer variable to the...
Questions
question
Mathematics, 05.02.2021 21:00
question
History, 05.02.2021 21:00
question
Mathematics, 05.02.2021 21:00
question
Mathematics, 05.02.2021 21:00
question
Mathematics, 05.02.2021 21:00
Questions on the website: 13722361