We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

“Dynamic memory allocation by using pointers provides an efficient way of utilizing computer memory but such memory allocation may be problematic if not handled properly in program.”

 

You have to support or contradict the given statement with proper justification.

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 1869

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Replies to This Discussion

o kuch tou Ans 2 Allah k bNdou ????

Dynamic Memory Allocation 
Memory allocated "on the fly" during run time
dynamically allocated space usually placed in a program segment known as the heap or the free store
Exact amount of space or number of items does not have to be known by the compiler in advance.
For dynamic memory allocation, pointers are crucial

Just idea

Efficiency is measured in two ways:


1. Time: how long does the algorithm take to complete.
2. Space: how much working memory (typically RAM) is needed by the algorithm. This has two aspects: the amount of memory needed by the code, and the amount of memory needed for the data on which the code operates.

Dynamic memory allocation beats in both task the design time memory allocation.

Dynamic Memory Allocation
Allocating memory
There are two ways that memory gets allocated for data storage:
1.Compile Time (or static) Allocation 
   Memory for named variables is allocated by the compiler
   Exact size and type of storage must be known at compile time
   For standard array declarations, this is why the size has to be constant
2.Dynamic Memory Allocation 
  Memory allocated "on the fly" during run time
  dynamically allocated space usually placed in a program segment known as the heap or the free store
  Exact amount of space or number of items does not have to be known by the compiler in advance.
  For dynamic memory allocation, pointers are crucial

Dynamic Memory Allocation

Dynamic memory allocation is a process that allows us to do exactly what we're looking to do above, to allocate memory while our program is running, as opposed to telling the computer exactly how much we'll need (and for what) ahead of time.


With dynamic memory allocation, while the program is running, the program requests more memory from the computer. If there's enough memory available, the computer will grant the program the right to use the amount it requests.

when you use a pointer it directly points to a distinct memory address..it increases efficiency of system because when you use arrays, etc and other data types. they just allocate the memory randomly,i.e there is no specific place allotted.
So pointers increase efficiency of a system

GDB solution of CS201 july 2013


“Dynamic memory allocation by using pointers provides an efficient way of utilizing computer memory but such memory allocation may be problematic if not handled properly in program.”


I do agree with this statement, pointer is a powerful feature of c++ and we all know the power can swing both sides good and evil. Pointer if used incorrectly leads to very difficult to unearth bugs which will most probably make you go wild. Every pointer is pointing to a memory location and if value is incorrect then it can lead to disasters of massive magnitude when used on the required block of code. It is actually equal to having an address of house but wrong.
Consider a scenario in banking in which any customers real account value is switched with this garbage value, he can become a millionaire or beggar in a second, or think that in a rocket launching software you use this incorrect value as launching angle and crashing the billion dollar masterpiece. 
These scenarios are just my imagination running wild but you cannot ignore the fact that they are possibility.

Yes the pointer allows to use the memory more effectively. You use the memory as much as you require. You don't need to create extra redundant memory ahead of time like what we do in the case of array.
But yes playing with dynamic memory is also tricky. If you don't handle it properly you face
Memory leaks
Dangling pointer exceptions
If there are memory leaks in your program, then you may face the same memory issues as in case of array and it get be greater.
On the other hand if there is dangling pointer exceptions due to dynamic memory in your, your program will perform badly, it will label as crap and buggy.
So yes the dynamic memory is blessing, but it can be forbidding if not done properly.

he weightage  of GDb is 5 

So ur GDb should be limit in between 100 to 150 words ,,,,,

All the best 

when you use a pointer it directly points to a distinct memory address.it increases efficiency of system because when you use arrays, etc and other data types. they just allocate the memory randomly,i.e. there is no specific place allotted.
So pointers increase efficiency of a system.

There are several ways to misuse memory. First, if you're allocating for say a 20 character sting, you need to allocate 21 bytes, 42 for wide characters, to allow for a the terminating 0. If your program tries to write 25 characters to that memory, you'll overrun into some other data's memory. When you're done with the memory, if it's not freed, you can run out of available memory.

RSS

Latest Activity

Khuzamah Rasheed posted a status
"full solution"
2 minutes ago
Khuzamah Rasheed posted a status
"kisi ke pas 402 code ki assignment hy fall 2019"
2 minutes ago
+ ! ! ! ! Mehαr Mαh꧂ posted a video

Wintergatan - Marble Machine (music instrument using 2000 marbles)

Get the audio track "Marble Machine" by Wintergatan: https://wintergatan.bandcamp.com/track/marble-machine Marble Machine built and composed by Martin Molin ...
10 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion MTH501 Assignment No 01 Fall 2019 Solution & Discussion Due Date: 19-11-2019 in the group MTH501 Linear Algebra
10 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion MGT603 Strategic Management Assignment No 01 Fall 2019 Solution & Discussion in the group MGT603 Strategic Management
11 minutes ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion MGT603 Strategic Management Assignment No 01 Fall 2019 Solution & Discussion
12 minutes ago
+ M.Tariq Malik added a discussion to the group MGT603 Strategic Management
12 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion MGT501 Human Resource Management Assignment No 01 Fall 2019 Solution & Discussion in the group MGT501 Human Resource Management
13 minutes ago
ALEENA replied to + M.Tariq Malik's discussion MTH501 Assignment No 01 Fall 2019 Solution & Discussion Due Date: 19-11-2019 in the group MTH501 Linear Algebra
13 minutes ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion MGT501 Human Resource Management Assignment No 01 Fall 2019 Solution & Discussion
13 minutes ago
ALEENA joined + M.Tariq Malik's group
13 minutes ago
+ M.Tariq Malik added a discussion to the group MGT501 Human Resource Management
13 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion HRM613 Performance Management Assignment No 01 Fall 2019 Solution & Discussion in the group HRM613 Performance Management
14 minutes ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion HRM613 Performance Management Assignment No 01 Fall 2019 Solution & Discussion
14 minutes ago
+ M.Tariq Malik added a discussion to the group HRM613 Performance Management
15 minutes ago
+ M.Tariq Malik replied to +¢αяєℓєѕѕ gιяℓ's discussion CS510 - Software Requirements and Specifications Assignment No. 1 Due Date Nov 18, 2019 in the group CS510 Software Requirements and Specifications
22 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion MTH302 Business Mathematics & Statistics Assignment No 01 Fall 2019 Solution & Discussion in the group MTH302 Business Mathematics & Statistics
27 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion MTH302 Business Mathematics & Statistics Assignment No 01 Fall 2019 Solution & Discussion in the group MTH302 Business Mathematics & Statistics
28 minutes ago
Hadi replied to + M.Tariq Malik's discussion CS605 Software Engineering-II Assignment No 01 Fall 2019 Solution & Discussion in the group CS605 Software Engineering-II
29 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion MTH302 Business Mathematics & Statistics Assignment No 01 Fall 2019 Solution & Discussion in the group MTH302 Business Mathematics & Statistics
29 minutes ago

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service