We use cookies to give you the best experience possible. By continuing we’ll assume you’re on board with our cookie policy

See Pricing

What's Your Topic?

Hire a Professional Writer Now

The input space is limited by 250 symbols

What's Your Deadline?

Choose 3 Hours or More.
2/4 steps

How Many Pages?

3/4 steps

Sign Up and See Pricing

"You must agree to out terms of services and privacy policy"
Get Offer

Advantages And Disadvantages Of Using A Pointer Computer Science

Hire a Professional Writer Now

The input space is limited by 250 symbols

Deadline:2 days left
"You must agree to out terms of services and privacy policy"
Write my paper

Write advantages and disadvantages of utilizing arrow. How the construct of arrows is utile in the execution of informations constructions?

A arrow allows a map or a plan to entree a variable outside the prevue map or a plan, utilizing pointer plan can entree any memory location in the computing machine ‘s memory.

Don't use plagiarized sources. Get Your Custom Essay on
Advantages And Disadvantages Of Using A Pointer Computer Science
Just from $13,9/Page
Get custom paper

2 ) since utilizing return statement a map can merely go through back a individual value to the naming map, arrows allows a map to go through back more than one value by composing them into memory locations that are accessible to naming map.

3 ) Use of arrow additions makes the plan executing faster

4 ) utilizing arrows, arrays and constructions can be handled in more efficient manner.

5 ) without arrows it will be impossible to make complex informations constructions such as coupled list, trees, and graphs.

Disadvantages of arrows: –

1 ) we can entree the restricted memory country.

2 ) Pointers require one extra dereference, intending that the concluding codification must read the variable ‘s arrow from memory, so read the variable from the pointed-to memory.

This is slower than reading the value straight from memory.

3 ) . If sufficient memory is non available during runtime for the storage of arrows, the plan may crash

When puting upA informations ststructuresA likeA lists, A queuesA and trees, it is necessary to hold arrows to assist pull off how the construction is implemented and controlled.Pointers and Structures can be used to construct informations constructions that expand and psychiatrist during executing illustrations stack waiting lines, trees etc.While arrow has been used to hive away the reference of a variable, it more properly applies to informations constructions whose interface explicitly allows the arrow to be manipulated as a memory address.Because arrows allow mostly unprotected entree to memory references.

2 ) . Elaborate the construct of “ Fixed block storage allotment ” and “ Buddy system ” in dynamic memory direction.


Fixed block storage allotment: – This is the simplest storage care method. Here each block is of the same size. The size is determined by the system director. Here the memory director maintain a arrow ‘ AVAIL ‘ which points a list of non immediate memory blocks.

A user plan communicate with the memory director by agencies of two map GETNODE ( NODE ) and RETURNNODE ( PTR ) .The procedure GETNODE is to acquire a memory block to hive away informations of type NODE. This process when invoked by a plan returns a arrow to first block in the pool of restorage. The AVAIL so points to the following block.If avail=NULL it indicates no more memory is available for allotment. Similarly whenever a memory block is no more needed it can be returned to the memory bank through a process RETURN NODE ( ) .

Buddy system: – It is the another storage direction system which restricts the size of blocks to some fixed set of sizes. These blocks of restricted sizes are maintained in a coupled list. Whenever a petition for a block of size N comes, the figure M the smallest of the fixed sizes but equal to or largest than N, is determined and a block of size M is allocated if available on the list. If non available so a larger block if available is split into two sub-blocks known a s brothers. Each of them are besides of fixed sizes and the procedure is repeated until a block of size M is produced. for illustration, if k=1 and Fo=8, so the block sizes are 8,16,32,64,128, aˆ¦ . THAT is, the block sizes are consecutive powers of 2 ; and the brother system based on such fixed sizes is called binary brother system.

3. ) Differentiate between inactive memory allotment and dynamic memory allotment. Illustrate assorted memory direction maps


In instance of inactive storage direction strategy, the net sum of memory required for assorted informations for a plan is allocated before the starting of the executing of a plan one time memory is allocated, it neither can be extended nor can be returned to the memory bank for the usage of other plans at the same clip. On the other manus dynamic storage direction strategies allows user to apportion and deallocate as per necessity during the executing of plans.

The inactive storage allotment is easy to implement and efficient from executing point of position.Here all variables those are required for a plan is allocated during compile clip this is why inactive storage allotment is a compile clip phenomena. In this each subprogram/subroutine of a plan is compiled individually and the infinite required for them is reserved till the executing of the plan. On the other manus dynamic memory allotment, infinite for memory variables is allocated dynamically that is as per the current demand during the executing. When a routine is invoked infinite for it is allocated and infinite is returned when the routine completes its executing. Therefore, the infinite required to run a plan is non fixed as in inactive allotment, instead it varies as plan execute.

Assorted memory direction maps: –

1 ) malloc ( ) : -The malloc map dynamically allocates memory from heap.The paradigm for malloc ( ) map is

Null *malloc ( size_t size ) ;

2 ) calloc ( ) : – The calloc ( ) map dynamically allocates memory automatically initializes the memory to nothings. The paradigm for calloc ( ) map is

Null *calloc ( size_t nitems, size_t size ) ;

It takes two statements. The first statement is the figure of elements and the 2nd statement is the size of each component.

3 ) realloc ( ) : – The realloc ( ) map changes the size of antecedently dynamically allocated memory with malloc ( ) , calloc ( ) , realloc ( ) functions.The paradigm for realloc ( ) map is

Null *realloc ( null *block, size_t size ) ;

It takes two statement. the first statement is the arrow to the original object and the 2nd statement is the new size of the object.

4. ) Write different ways to pull off records in memory

Sol. ) Since records may incorporate not homogenous informations, the elements of a record can non be stored in an array. Some programming linguistic communications such as PASCAL and COBOL do hold record constructions built into the linguistic communication.

Suppose a programming linguistic communication does non hold available the hierarchal constructions that are available in PASCAL and COBOL. Assuming the record contains not homogenous informations, the record may hold to be stored in single variables, one for each of its simple informations points. On the other manus one wants to hive away an full file of records, such a file may be stored in memory as a aggregation of arrays that is, where elements in different arrays with the same inferior belonging to the same record.


1. ) Illustrate the usage of array of arrows and arrows to an array

Sol. )

An array of arrows is that for eg if we have array of 10 int arrows ie int *a [ 10 ] so each component that which is stored in array are pointed by arrows. here we will hold ten arrows. In arrow to an array for eg int ( *a ) [ 10 ] here all the elements that is all the 10 elements are pointed by a individual arrow.

int *a [ 10 ] : -array of arrows.

see one array int B [ 10 ] = { 1,2,3,4,5,6,7,8,9,0 } ; so

elements will be stored in references.now this reference are

stored in array of pointers.thats

int *a [ 10 ] = { b+0, b+1, b+2, b+3, b+4, b+5, b+6, b+7, b+8, b+9 } ; means a+0=address of value 1 is the first component of int

*a [ ] ( first component of int B [ 10 ] ) and so on.

while int ( *a ) [ 10 ] : -here a is an arrow to an array incorporating 10

whole numbers.

suppose int B [ 10 ] ;

so a= & A ; b [ 10 ] ;

this will give component of int B [ 10 ] array thats b [ 0 ] ; and so on but in instance of two dimensional array foremost we have to apportion base reference of several one dimensional array and base reference of component of one dimensional array so merely we can utilize arrow to an array.

Give illustration to demo the usage of far arrow and swinging arrow jobs

Sol. )

A far arrow uses both the section and the beginning reference to indicate to a location in memory A The far arrow can indicate to any location in memory. . Far arrows have a size of 4 bytes. They store both the section and the beginning of the reference the arrow is citing. A far arrow has an address scope of 0 – 1M bytes. A far arrow can be incremented and or decremented Merely the beginning of the arrow is really incremented or decremented. The section is ne’er incremented by the arithmetic operators.On the other manus Dangling arrows are the arrows that do non indicate tao a valid object of the appropriate type. These arrows arise when an object is deleted or deallocated, without modifting the value of the arrow so that arrow stll points to the memory location of deallocated memory.As the system may reapportion the antecedently freed memory to another procedure, if the original plan so derefrences the suspension arrow, consequences in bugs or mistakes as the memory may incorporate wholly different data.A

See the undermentioned illustration


char *cp = NULL ;


char degree Celsius ;

cp = & A ; degree Celsiuss ;

} A

/* cp is now a suspension arrow */


Solution to swinging arrow:

char *cp = malloc ( A_CONST ) ;

free ( cp ) ; /* cp now becomes a suspension arrow */

cp = NULL ; /* cp is no longer swinging */

Differentiate between linked list and arrays in footings of representations, traverse and searching.

Sol. )

1 ) In instance of array traversing is used sing all elements in an array while to track a individual linked list we mean to see every node in the list get downing from first node to last node.

2 ) .Searching operation in an array is applied to seek an element involvement in an array.It is a procedure of happening the location of given component in an array.The hunt is said to be successful if the given component is found.there are two types of hunt operation:

Linear hunt

Binary hunt

If the array elements are in random order so one have to utilize additive hunt technique and if the array elements are sorted so it is preferred to take binary hunt technique.While in instance of linked list merely additive searching is possible.This is one of the restriction of coupled lists as there is no manner to happen the location of the in-between component of the list.

can we execute binary hunt in coupled list, if no so exemplify the ground.

Sol. )

No, we can non execute binary hunt in linked list because there is no manner

Of indexing the in-between component in the list. With a sorted additive array we can use a binary hunt whose running clip is relative to log2n. On the other manus a binary hunt algorithm can non be applied to a sorted coupled list, since there is no manner of indexing the in-between component in the list. This belongings is one of the chief drawbacks in utilizing a linked list as a information construction.

Cite this Advantages And Disadvantages Of Using A Pointer Computer Science

Advantages And Disadvantages Of Using A Pointer Computer Science. (2016, Dec 05). Retrieved from https://graduateway.com/advantages-and-disadvantages-of-using-a-pointer-computer-science-essay/

Show less
  • Use multiple resourses when assembling your essay
  • Get help form professional writers when not sure you can do it yourself
  • Use Plagiarism Checker to double check your essay
  • Do not copy and paste free to download essays
Get plagiarism free essay

Search for essay samples now

Haven't found the Essay You Want?

Get my paper now

For Only $13.90/page