Using pointers may cause a number of problems. While all of the following codes do not...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Using pointers may cause a number of problems. While all of the following codes do not have any syntax errors, please identify the potential problem associated with the use of pointers for each of the following pieces of code in C/C++ (note: be specific in describing the potential problem.) (a) int *p1, *p2; p1 = new int (2); p2 = p1; delete p1; (b) int *p1; p1 new int [1000]; p1 new int [10]; Potential problem_ Potential problem_ (c) int *arr = new int [100]; int index = 0; //open a file to a file stream inf while (inf) { ...read in a data from a file... arr[index++] = data; Activate Wi Potential problem_ Go to Settings t Using pointers may cause a number of problems. While all of the following codes do not have any syntax errors, please identify the potential problem associated with the use of pointers for each of the following pieces of code in C/C++ (note: be specific in describing the potential problem.) (a) int *p1, *p2; p1 = new int (2); p2 = p1; delete p1; (b) int *p1; p1 new int [1000]; p1 new int [10]; Potential problem_ Potential problem_ (c) int *arr = new int [100]; int index = 0; //open a file to a file stream inf while (inf) { ...read in a data from a file... arr[index++] = data; Activate Wi Potential problem_ Go to Settings t
Expert Answer:
Answer rating: 100% (QA)
a cpp int p1 p2 p1 new int2 p2 p1 delete p1 Potential problem The potential problem here is that aft... View the full answer
Related Book For
Understanding Business Ethics
ISBN: 9781506303239
3rd Edition
Authors: Peter A. Stanwick, Sarah D. Stanwick
Posted Date:
Students also viewed these operating system questions
-
answer the question clearly You are building a flight-control system for which a convincing safety case must be made. Would you assign the tasks of safety requirements engineering, test case...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Nanette works for Piroz and is paid a basic wage of $1,000 a week. Piroz operates the following bonus scheme: (1) Each employee gets a bonus of $4 for every unit they produce in excess of 2,000 units...
-
How do these types of incentives relate to the overall goal of sustainability for the company?
-
The following adjusted trial balance for Bell Servicing was prepared at the end of the fiscal year, December 31, 2014: Required 1. Prepare a classified multiple-step income statement that would be...
-
Blockbuster, Inc., is the world's leading provider of rentable DVDs and videogames. Blockbuster estimates that 64 percent of the U.S. population lives within a 10-minute drive of a Blockbuster store....
-
The mean gestational length of a sample of 208 horses is 343.7 days, with a standard deviation of 10.4 days. The data set has a bell-shaped distribution. (a) Estimate the number of gestational...
-
Leveraged Investing with Eligible Dividends $50,000 Cash purchase + $50,000 borrowed funds at 4.95% 12 month holding period Eligible monthly dividend of $0.07/share Purchase price of $25.00 Sale...
-
You have a 9 9 grid of squares, each of which can be colored red or blue. The grid is initially colored all blue, but you can change the color of any square any number of times. Imagining the grid...
-
Suppose that we want to have a yearly income of $50,000 in retirement. We expect to live 25 years in retirement and our inflation-adjusted rate of return on our safe investment is 3%. How much money...
-
How can one engage in effective cross-cultural communication in organizations?
-
Do you agree that demonstrating passion is a good predictor of a great job candidate worthy of being considered during the hiring process? Why or why not? How important are passion and commitment...
-
Judy Smart is a 17-year-old high school junior. One Saturday night, she is drinking beer with a number of her high school friends in the basement of her home. Judys parents, Bob and Mary Smart, are...
-
Can you think of any barriers that impacted communication effectiveness in this situation? How might one attempt to alter how they communicate to address or eliminate any of these barriers?
-
Compare and contrast the communication styles during the role-playing exercise. What was unique about them? How effective or ineffective was the communication of Blake and Ada in both simulations?
-
Your client, Bigco, is considering buying Littleco. Littlecos particulars are as follows: Assets: FMV=100mm; adjusted basis 40mm Liabilities: none Market Value of stock: 130mm Location: Incorporated...
-
Explain why it is not wise to accept a null hypothesis.
-
Why are poverty and hunger seen as business issues?
-
Why dont U.S. firms focus on the poor as a potential target market?
-
On October 29, 2003, Richard Scrushy, the former CEO of HealthSouth, was indicted by the federal government on 85 counts of fraud. He was released on a $10 million bond and a proposed trial date was...
-
Identify the primary purposes of an initial client interview.
-
Define unbundled legal services.
-
Identify the kinds of resources included in a basic family law library.
Study smarter with the SolutionInn App