Starting Out with C++ from Control Structures to Objects Plus MyLab Programming with Pearson eText -- Access Card Package (9th Edition)
9th Edition
ISBN: 9780134544847
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 9.9, Problem 9.13CP
Assume ip is a pointer to an int. Write a statement that will dynamically allocate an integer variable and store its address in ip. Write a statement that will free the memory allocated in the statement you wrote above.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Consider the expression: ?=−?∗(?+?)
Write the three – address code for this expression and translate the expression into:
(i) quadruples
(ii) triples
(iii) indirect triples
Hello, I am practicing code in my Python book and I am struggling to define the submit and clear buttons for this Address Entry Form. It isn't working and states that they aren't defined. I also cannot get the 'sunken' effect look on the window frame. Can you help? My code is below.
# Import tkinter
import tkinter as tk
# Define the submit button with a function
def submit(): print("First Name: %s\nLast Name: %s\nAddress Line 1: %s\nAddress Line 2: %s\nCity: %s\nState/Province: %s\nCountry: %s" % (e1.get(), e2.get(), e3.get(), e4.get(), e5.get(), e6.get(), e7.get()))
# Define the clear button with a function
def clear(): e1.delete(0, 'end') e2.delete(0, 'end') e3.delete(0, 'end') e4.delete(0, 'end') e5.delete(0, 'end') e6.delete(0, 'end') e7.delete(0, 'end')
# Create the master title
master = tk.Tk()master.title("Address Entry Form")
# Create the 'sunken' look for the window frame
sunken_frame = tk.Frame(master, relief=tk.SUNKEN)
# Create the labels…
Command line arguments are passed to int main(int argc, char** argv) as arguments argc and argv. You should assume that argc is at ebp+8 and argv is at ebp+12.
00000000 <what>: 0: push %ebp 1: mov %esp,%ebp 3: sub $0x10,%esp 6: mov 0x8(%ebp),%eax 9: add $0x4,%eax c: mov %eax,-0x4(%ebp) f: mov 0x8(%ebp),%eax 12: imul 0xc(%ebp),%eax 16: mov %eax,-0x8(%ebp) 19: mov 0x8(%ebp),%eax 1c: sub 0xc(%ebp),%eax 1f: mov %eax,-0xc(%ebp) 22: mov -0x4(%ebp),%edx 25: mov -0x8(%ebp),%eax 28: add %eax,%edx 2a: mov -0xc(%ebp),%eax 2d: add %edx,%eax 2f: leave 30: ret00000031 <main>: 31: lea 0x4(%esp),%ecx 35: and $0xfffffff0,%esp 38: pushl -0x4(%ecx) 3b: push %ebp 3c: mov %esp,%ebp 3e: push %ebx 3f: push %ecx 40: sub $0x10,%esp 43: mov %ecx,%ebx 45: mov 0x4(%ebx),%eax 48: add $0x4,%eax 4b: mov (%eax),%eax 4d: sub…
Chapter 9 Solutions
Starting Out with C++ from Control Structures to Objects Plus MyLab Programming with Pearson eText -- Access Card Package (9th Edition)
Ch. 9.5 - Prob. 9.1CPCh. 9.5 - Write the definition statement for a variable...Ch. 9.5 - List three uses of the symbol in C++.Ch. 9.5 - What is the output of the following code? int x =...Ch. 9.5 - Rewrite the following loop so it uses pointer...Ch. 9.5 - Prob. 9.6CPCh. 9.5 - Prob. 9.7CPCh. 9.5 - Is each of the following definitions valid or...Ch. 9.9 - Prob. 9.9CPCh. 9.9 - Give an example of the proper way to call the...
Ch. 9.9 - Complete the following program skeleton. When...Ch. 9.9 - Look at the following array definition: const int...Ch. 9.9 - Assume ip is a pointer to an int. Write a...Ch. 9.9 - Prob. 9.14CPCh. 9.9 - Prob. 9.15CPCh. 9.9 - Prob. 9.16CPCh. 9.9 - Prob. 9.17CPCh. 9 - What does the indirection operator do?Ch. 9 - Look at the following code. int x = 7; int iptr =...Ch. 9 - So far you have learned three different uses for...Ch. 9 - Prob. 4RQECh. 9 - Prob. 5RQECh. 9 - Prob. 6RQECh. 9 - What is the purpose of the new operator?Ch. 9 - What happens when a program uses the new operator...Ch. 9 - Prob. 9RQECh. 9 - Prob. 10RQECh. 9 - Prob. 11RQECh. 9 - Prob. 12RQECh. 9 - Each byte in memory is assigned a unique...Ch. 9 - The _________ operator can be used to determine a...Ch. 9 - Prob. 15RQECh. 9 - The ________ operator can be used to work with the...Ch. 9 - Array names can be used as ________, and vice...Ch. 9 - Prob. 18RQECh. 9 - The ________ operator is used to dynamically...Ch. 9 - Under older compilers, if the new operator cannot...Ch. 9 - Prob. 21RQECh. 9 - When a program is finished with a chunk of...Ch. 9 - You should only use pointers with delete that were...Ch. 9 - Prob. 24RQECh. 9 - Look at the following array definition: int...Ch. 9 - Prob. 26RQECh. 9 - Assume tempNumbers is a pointer that points to a...Ch. 9 - Look at the following function definition: void...Ch. 9 - Prob. 29RQECh. 9 - Prob. 30RQECh. 9 - Prob. 31RQECh. 9 - T F The operator is used to get the address of a...Ch. 9 - T F Pointer variables are designed to hold...Ch. 9 - T F The symbol is called the indirection...Ch. 9 - T F The operator dereferences a pointer.Ch. 9 - T F When the indirection operator is used with a...Ch. 9 - T F Array names cannot be dereferenced with the...Ch. 9 - Prob. 38RQECh. 9 - T F The address operator is not needed to assign...Ch. 9 - T F You can change the address that an array name...Ch. 9 - T F Any mathematical operation, including...Ch. 9 - T F Pointers may be compared using the relational...Ch. 9 - T F When used as function parameters, reference...Ch. 9 - T F The new operator dynamically allocates memory.Ch. 9 - T F A pointer variable that has not been...Ch. 9 - Prob. 46RQECh. 9 - T F In using a pointer with the delete operator,...Ch. 9 - Prob. 48RQECh. 9 - Prob. 49RQECh. 9 - int x, ptr = nullptr; ptr = x;Ch. 9 - Prob. 51RQECh. 9 - Prob. 52RQECh. 9 - Prob. 53RQECh. 9 - float level; int fptr = level;Ch. 9 - Prob. 55RQECh. 9 - Prob. 56RQECh. 9 - Prob. 57RQECh. 9 - Prob. 58RQECh. 9 - int pint = nullptr; pint = new int[100]; //...Ch. 9 - Prob. 60RQECh. 9 - Prob. 61RQECh. 9 - Prob. 62RQECh. 9 - Array Allocator Write a function that dynamically...Ch. 9 - Test Scores #1 Write a program that dynamically...Ch. 9 - Drop Lowest Score Modify Problem 2 above so the...Ch. 9 - Test Scores #2 Modify the program of Programming...Ch. 9 - Prob. 5PCCh. 9 - Case Study Modification #1 Modify Program 9-19...Ch. 9 - Case Study Modification #2 Modify Program 9-19...Ch. 9 - Mode Function In statistics, the mode of a set of...Ch. 9 - Median Function In statistics, when a set of...Ch. 9 - Reverse Array Write a function that accepts an int...Ch. 9 - Array Expander Write a function that accepts an...Ch. 9 - Element Shifter Write a function that accepts an...Ch. 9 - Movie Statistics Write a program that can be used...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Write a method named square that accepts an integer argument and returns the square of that argument.
Starting Out with Java: From Control Structures through Objects (6th Edition)
Write the function htoi(s), which converts a suing of hexadecimal digits (including an optional 0x or 0X) into ...
C Programming Language
Suppose that a 2 MB file consisting of 512-byte logical blocks is stored on a disk drive with the following cha...
Computer Systems: A Programmer's Perspective (3rd Edition)
Give the complete definition of a class called Person that has two instance variables, one for the persons name...
Java: An Introduction to Problem Solving and Programming (7th Edition)
The _________ is the part of a computer with which the user interacts. a. central processing unit b. user inter...
Starting Out with Programming Logic and Design (4th Edition)
This book declares the main method as public static void main(String[] args) Can it be replaced by one of the f...
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- // Program 4.4.1#include <iostream>using namespace std;int main (){ int var = 20; // actual variable declaration. int *ip; // pointer variable ip = &var; // store address of var in pointer variable cout << "Value of var variable: "; // print the variable value cout << var << endl<<endl; cout << "Address stored in ip variable: "; // print the address stored in ip pointer variable cout << ip << endl<<endl; cout << "Value of *ip variable: "; // access the value at the address available in pointer cout << *ip << endl; return 0;} TASK 1. Explain in details what the program does? 2. What is the output.arrow_forward1)Answer the question with the correct option A) Which of the following assigns to the pointer p to the address of value? options are given p = value; *p = &value; p = &value; p = &value;arrow_forwardSOLVE IN C# A bank store its client balance in amount.txt file as follow 332000 2320000 540000 45000 321000 Write a program to read the file and print the total amount store in amount.txt file, and then write this amount on screen and to a new file name backup.txtarrow_forward
- Which of the following is/are valid ways to allocate memory for an integer by dynamic memory allocation in CPP? a. int *p = new int(100); b. int *p; p = new int; *p = 100; c. int *p = NULL; p = new int; *p=100; d. Only 1,2 e. All of thesearrow_forward// Program 4.6.1 #include <iostream>using namespace std;int main (){int X = 5, Y = 15; int * p1, * p2;p1 = &X; // p1 = address of Xp2 = &Y; // p2 = address of Y*p1 = 10; // value pointed by p1 = 10*p2 = *p1; // value pointed by p2 = value pointed by p1p1 = p2; // p1 = p2 (value of pointer is copied)*p1 = 40; // value pointed by p1 = 20cout << "X is " << X << endl;cout << "Y is " << Y << endl;return 0;} TASK 1. Explain in details what the program does? 2. What is the outputarrow_forwardComplete the following sentences by filling the right word To check if two string variables string1 and string2 refer to the same memory address we use the command ………arrow_forward
- Modify this code to let it run concurrently to send and receive any messages between 2 processes and take one command line argument to change between 2 processes, for example, 1 or 2 to indicate the process 1 or process 2. #include <unistd.h>#include <stdlib.h>#include <stdio.h> #include <string.h>#include <fcntl.h>#include <sys/types.h>#include <sys/stat.h>#define FIFO_NAME “/tmp/my_ fo”int main(int argc, char *argv[]){int res, open_mode = 0; if (argc < 2){fprintf(stderr, “Usage: %s <[O_RDONLY, O_WRONLY, O_RDWR, O_NONBLOCK]>\n”, *argv); exit(EXIT_FAILURE);}argv++;if (*argv){if (strncmp(*argv, “O_RDONLY”, 8) == 0)open_mode |= O_RDONLY;if (strncmp(*argv, “O_WRONLY”, 8) == 0)open_mode |= O_WRONLY; if (strncmp(*argv, “O_RDWR”, 6) == 0) open_mode |= O_RDWR;if (strncmp(*argv, “O_NONBLOCK”, 10) == 0)open_mode |= O_NONBLOCK;} if (access(FIFO_NAME, F_OK) == -1{res = mk fo(FIFO_NAME, 0777);if (res){fprintf(stderr, “Could not create fo%s\n”,…arrow_forwardComputer Science Below question is based on google cloud Function Assume you have a Cloud Function created and it is set for unauthenticated invocation. Further assume the trigger type is HTTP. You may use whichever language you prefer for Google Cloud. What is the code required to display the following message from the page, assuming that username and status are passed in as querystring variables? Your assigned username is: username Your status is: statusarrow_forwardAllocate memory for a string of 15 characters and assign “new string” to it. Print the string. Now, try following options: Change the string to “another string” using assignment operator. Change the string to “another string” using strcpy. Note down whether the address changes in both cases or not.arrow_forward
- Hello I need help with the following question, I have provided my work that I have done and an example of completed work from the class. This is the question I need help with. A system currently accessing 3.8 G bytes of RAM and 10 M bytes of ROM. Compute the number of address lines required to access the designated storage. For a given # of lines how many more storage space is accessible? Currently out of 3.8 G, 3 G is used by the system programs, .4 G by an application. Can we expand the memory by another 890 M to support a new application? show total storage use and available. Show all your work.arrow_forwardWrite a C program that uses the following: a main() to read two integer values from the user, val1 and val2, and prints the returned value from swap().a swap() that uses call by reference (takes the addresses into pointers) to swap values, and prints their values after the swap "num1 = # and num2 = #". This function returns the largest of the two values. If these are equal, it returns their sum.arrow_forward1.Code a descriptor that contains a starting address 8A0000H and an ending address 8A1119H. If DS = 1095 and expands downward and can be written, what is the entry level, descriptor table used, and the RPL?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Instruction Format (With reference to address); Author: ChiragBhalodia;https://www.youtube.com/watch?v=lNdy8HREvgo;License: Standard YouTube License, CC-BY