3. What is the output of the following?
char ptr1[] = "Hello World";
char *ptr2 = malloc( 5 );
ptr2 = ptr1;
What is wrong with the above code (assuming the call to malloc does not fail)?
Pick ONE option
a.There will be a memory overwrite.
b.There will be a segmentation fault.
c.Not enough space is allocated by the malloc.
d.It will not compile in C++.
Answers
Answered by
3
Answer:
(c)
Explanation:
not enough space is allocated by the malloc
Answered by
1
Answer:
The correct answer is option a. There will be a memory overwrite.
Explanation:
- Overwrite is a word that describes when fresh data or information replaces existing data or information.
- The name comes from the word overwrite, which means it replaces deleted data with fresh data.
- Writing a collection of data (binary) in computer data storage, with fresh information to replace the prior information, is the procedure. Overwritten data is often considered unrecoverable.
- It is not safe to overwrite hard discs. One of the most serious issues with overwriting is the operator's ability to chose not to overwrite all information
- On the hard disc, thereby ensuring that your security is compromised. Degaussing eliminates the insecurity of choice by destroying all data.
#SPJ2
Similar questions
Math,
4 months ago
CBSE BOARD X,
4 months ago
Physics,
8 months ago
Biology,
1 year ago
Math,
1 year ago