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: 1907

.

+ 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

Muhammad Bilal replied to NOORI's discussion SOC101 1ST ASSIGNMENT SPRING 2020 in the group SOC101 Introduction to Sociology
19 minutes ago
Maria replied to imran's discussion ENG101 k quiz koi kara sakta hai plzz
4 hours ago
Maria replied to imran's discussion ENG101 k quiz koi kara sakta hai plzz
4 hours ago
NOORI added a discussion to the group SOC101 Introduction to Sociology
4 hours ago
NOORI joined +M.Tariq Malik's group
4 hours ago
NOORI added a discussion to the group ENG201 Business and Technical English Writing
4 hours ago
NOORI replied to Nasir's discussion Eng201. Quizz no 1.. Dated 01-06-2020 to 03-06-2020 in the group ENG201 Business and Technical English Writing
4 hours ago
Profile IconNOORI, Haroon Bahadar and Nasir joined +M.Tariq Malik's group
4 hours ago
+ ! ! ! ! ! ! !pคຖ໓คค ! ! posted a discussion
5 hours ago
naila mukhtar joined +M.Tariq Malik's group
5 hours ago
+ ! ! ! ! ! ! !pคຖ໓คค ! ! replied to MUHAMMAD ADIL JAVEED's discussion CS603 Software Architecture and Design | Assignment No 01 | Spring 2020 | Last date 01/06/2020 in the group CS603 Software Architecture and Design
5 hours ago
Profile Icon+ ! ! ! ! ! ! !pคຖ໓คค ! !, Muhammad Irshad and Saddam Hussain joined +M.Tariq Malik's group
5 hours ago

Today Top Members 

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

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

.