We have been working very hard since 2009 to facilitate in your learning Read More. We can't keep up without your support. Donate Now.

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

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

Why Pointers are important in C/C++              Total Marks= 5

Pointer is a special type of variable in which memory address is stored. Use of pointers in C++ has some cost associated with it because it gives some power and with great power comes great responsibility. 

Why you think pointers are important and what are the precautions that you should keep in mind while using pointers in C/C++”.

Provide answer with solid arguments.

NOTE:

·Your answer should be concise and to the point.

·No GDB is accepted via e-mail in either case

·Lengthy replies of GDB will cause in deduction of marks

·Copied from internet or any source will be graded “Poor”.


+ 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)


Views: 1563

Replies to This Discussion

Part No1

Why pointers are important?

Pointers are just another way for your program to express indirection -- in other words, to access something without using it's name. You use indirection when accessing some element of an array: my_array[22];.

So in a way, pointers are a bit like array indices. But they're more versatile, since you don't need to have an array around to use them. They let you access things that your program doesn't own, or needs to share between programs or between modules of the same program.

Part No2

Precautions that should keep in mind?

Some of them that i know

Always initialize them
Check the bounds (size of pointer offset / index)
free the memory when done

Set to NULL after freeing

Please discuss this i m right or not, and what arguments use for this.

Please Discuss here about this GDB.Thanks

Our main purpose here discussion not just Solution

We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions. Read More>>

 

Note:-

For Important Helping Material related to this subject (Solved MCQs, Short Notes, Solved past Papers, E-Books, FAQ,Short Questions Answers & more). You must view all the featured Discussion in this subject group.

For how you can view all the Featured discussions click on the Back to Subject Name Discussions link below the title of this Discussion & then under featured Discussion corner click on the view all link.

Or visit this link 

Click Here For Detail.

&

.•°How to Download past papers from study groups°•.

 

Please Click on the below link to see…

.... How to Find Your Subject Study Group & Join .... 

Pointers are a special type of Variables in which a memory address s stored. They contain a memory address, not the value of the variable.

Advantages:

Pointers are used to access a data which is available outside a function.

Pointers are used to increase the execution speed of program.

Pointers are used to handle any type of data structure.

Pointers are used to implement dynamic memory allocation.

Pointers are used to return more than one value from function.

Pointers are used to reduce the length and complexity of a program.

Pointers are used to pass and handle variable parameters passed to function.

Pointers are used to access information stored in arrays (Specially when we works with links).

Pointers also provides us an alternative way to access array elements.

Disadvantage:

Whenever you declare a pointer initialize them to the required field or NULL.

If we dont need a pointer just free up the memory allocated to it.

While declaring pointers to functions use ().

Void pointers cant be dereferenced. be careful while using these.

Use realloc() only for dynamically allocated memory.

Always try to delete the pointer after creation of new.

 

Pointers are a special type of Variables in which a memory address s stored. They contain a memory address, not the value of the variable.

Advantages:

Pointers are used to access a data which is available outside a function.

Pointers are used to increase the execution speed of program.

Pointers are used to handle any type of data structure.

Pointers are used to implement dynamic memory allocation.

Pointers are used to return more than one value from function.

Pointers are used to reduce the length and complexity of a program.

Pointers are used to pass and handle variable parameters passed to function.

Pointers are used to access information stored in arrays (Specially when we works with links).

Pointers also provides us an alternative way to access array elements.

Disadvantage:

Whenever you declare a pointer initialize them to the required field or NULL.

If we dont need a pointer just free up the memory allocated to it.

While declaring pointers to functions use ().

Void pointers cant be dereferenced. be careful while using these.

Use realloc() only for dynamically allocated memory.

Always try to delete the pointer after creation of new.

 

CS201 GDB Solution by JWH Team.
This article was for Java language but it may be helpful for you. just for educational purpose.

Why Pointers are Important in Java?
We usually use pointers simply as a reference to another variable in our programs. Well, for such cases, you can say that there is no need to expose memory addresses and a programming language will do fine with just references (as Java does) .In our whole programing we use the pointers. A struct is a pointer, an array is a pointer, a string is a pointer and a class is a pointer even a variable is a pointer which points his value. Pointers are necessary for dynamic memory location, many data structures, and efficient handling of large amounts of data. Also, pointers are useful for Efficiency. If you pass ten thousand ints to a Function, you will have a substantial Time penalty, unless you pass a Pointer to an array of ten thousand ints. Pointers can be faster and can incur less overhead, both in data structures and in keeping the program execution footprint down. Pointers are not there only for referencing existing variables. They are there to support direct interactions with hardware. That's a must for any systems programming language as without pointers you are unable to write a device driver. For example, if you want to read data from a device in your program, you need to instruct the device to write n bytes in address a. Because of that, you need a data type that can store addresses and an operator that returns the address of a variable.
What are precautions while using pointers?
Use a valid name while declare the pointer.
Always initialize pointer variable.
Set the pointer NULL after use for free the memory.
This is the best to initialize all pointers to null.
Release the memory once you are done with it.

We help in (C, C++, Java, C#, J#, HTML, CSS, JavaScript, VBScript, PHP, ASP, VB.Net and VBA)
Send your Question file at: jwh.team@gmail.com
38 problems solve in a day
JWH Team.
Denis Richard
John Lawton
Ahmad Umar
Abhilash Kumar
Naresh Khanna
David worn
Sami Zain
We had seen many YouTube videos and articles that copy our sources. We don’t allow to anyone to use our code and sources for their personals or business use. Our all sources like programing codes and demos are only for educational purpose because we are educators not businessman. If we found any other copy issue we will contact with YouTube for block your channel.

Cs201-Introduction To Programming GDB Solution

        Pointers are a special type of variables in which a memory address isstored.They contain a memory address not the value of the variable.pointers are used to access a data which is available outside a function.pointers are used to increase the execution speed of program and handle any type of data structure. pointers are used to implement dynamic memory allocation and return more than one value from function. pointers are used to reduce the length and complexity of a program and pass and handle variable parameters passed to function.pointers also provides alternative way to access array elements.

 

Precautions while using pointers

While using pointers use a valid name while declare the pointer.Always initialize pointer variable and set the pointer NULL after use for free the memory.

Pointers are used in call by reference phenomenon.If we have to pass a huge number of values to a function, it is not advisable to copy these huge numbers of values. In such cases, it is better to pass the reference of the variables. So pointers are useful in this scenario. Pointers are also useful as you can access different variables values using a same pointer. Same pointer can hold memory address of different variables. Pointer is also helpful in array manipulation because it can hold different memory location of the array so it is much beneficial in linked arrays.

RSS

Looking For Something? Search Here

Latest Activity

Rimsha mujahid liked +M.Tariq Malik's discussion SOC101 SOC101 Short Notes Glossary - SOC101 Short Questions Answers - SOC101 Subjective Solved Questions
5 hours ago
+ ! ! ! ❣ Sanam ❣ !+ updated their profile
8 hours ago
+M.Tariq Malik replied to +M.Tariq Malik's discussion SOC101 SOC101 Short Notes Glossary - SOC101 Short Questions Answers - SOC101 Subjective Solved Questions in the group SOC101 Introduction to Sociology
8 hours ago
+M.Tariq Malik replied to +M.Tariq Malik's discussion SOC101 SOC101 Short Notes Glossary - SOC101 Short Questions Answers - SOC101 Subjective Solved Questions in the group SOC101 Introduction to Sociology
8 hours ago
+M.Tariq Malik replied to +M.Tariq Malik's discussion SOC101 SOC101 Short Notes Glossary - SOC101 Short Questions Answers - SOC101 Subjective Solved Questions in the group SOC101 Introduction to Sociology
8 hours ago
+M.Tariq Malik replied to +M.Tariq Malik's discussion SOC101 SOC101 Short Notes Glossary - SOC101 Short Questions Answers - SOC101 Subjective Solved Questions in the group SOC101 Introduction to Sociology
8 hours ago
+M.Tariq Malik replied to +M.Tariq Malik's discussion SOC101 SOC101 Short Notes Glossary - SOC101 Short Questions Answers - SOC101 Subjective Solved Questions in the group SOC101 Introduction to Sociology
8 hours ago
+M.Tariq Malik replied to +M.Tariq Malik's discussion SOC101 SOC101 Short Notes Glossary - SOC101 Short Questions Answers - SOC101 Subjective Solved Questions in the group SOC101 Introduction to Sociology
8 hours ago

HELP SUPPORT

This is a member-supported website. Your contribution is greatly appreciated!

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

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

.