Cramster.com - Homework Solutions, Lecture Notes, Exams, and Free Online Homework Help
Sign Up Now! Login Customer Support Cramster Blog
McAfee Secure sites help keep you safe from identity theft, credit card fraud, spyware, spam, viruses and online scams
Problem Solved.
    Home    
    Homework Help    
   Answer Board   
    Resources (Beta)    
   
Member's Topic Headline:

Urgent help!!!!!!!!!!!!!!!!!!:->in c++

Know the answer? Have a better solution? Share it.
Sign Up Now for FREE!
Join the thousands of students
getting ahead in their classes.
Member Testimonials

Question:

Advertisement:

Answer | Ask New Question | Customize Profile | Leaderboards | 
FAQ

Member's Avatar

Novice
Karma Points: 36
Respect (48%):
Date Posted: 7/25/2008 12:53:55 AM  Status: Live
Urgent help!!!!!!!!!!!!!!!!!!:->in c++
Course Textbook Chapter Problem
N/A N/A N/A N/A
Question Details:

There are two general comments about pointers

1. Pointers increase the efficiency of our programs

2. Pointers degrade reliability of C++ programs due to security
issues

Give your views on these comments and justify your answer,  whether you agree or
disagree with above comments.

Answers:

Member's Avatar

Mentor
Karma Points: 527
Date Posted: 7/25/2008 12:58:04 AM  Status: Live
Asker's Rating: None Provided    Moderator's Rating: Helpful
Response:
hiii frnd,

The main advantages of using pointers are
1.) Function cannot return more than one value. But when the same function can modify many pointer variables and function as if it is returning more than one variable.
2.) In the case of arrays, we can decide the size of th array at runtime by allocating the necessary space.

Coming to the disadvantages of pointers
1.) If sufficient memory is not available during runtime for the storage of pointers, the program may crash (least possible) ..

i hope it will help u..



Member's Avatar

Expert
Karma Points: 811
Date Posted: 7/25/2008 1:59:18 AM  Status: Live
Asker's Rating: None Provided    Moderator's Rating: Helpful
Response:
Dear,

Pointers increase the efficiency of our programs :  I agree

Pointers give the memory address(logical) to  programmer  where data is stored. So programmer can directly modify the data so Pointer give more control over where data is stored and how it is initialized. e.g pointers made possible to access hardware directly.
That's make the pointers efficient.
 
Security issue: I agree
Accessing the memory directly make the program insecure. E.g in C/C++ we can access/modify the whole array if we know the base address of array. But it can be dangerous if we cross the limit of array. This will damage other memory locations or will make the core dump. That's make the pointer insecure. But it can be avoided by extra care.


Member's Avatar

Expert
Karma Points: 1,027
Date Posted: 7/25/2008 8:09:24 AM  Status: Live
Asker's Rating: None Provided    Moderator's Rating: N/A
Response:
 
Dear...
 
The context is not specified clearly,i am considering this way to justify. 
Accessing a variable or object through a pointer or reference may be just as fast asaccessing it directly. 
calling a function through a function pointer typically takes a few clock cycles more than calling the function directly. Thus we can say efficiency can be increase .
 
Hope this will help yu

 




By reading or posting messages on these forums, you are agreeing to the Answer Board's Terms of Service and Conduct (TSC).


About Cramster | Terms of Use | Privacy Policy | Contact Us | Press Room | Site Map | Support | Anti-Cheating Policy

Cramster.com is not affiliated with any publisher. Book covers, title and author names appear for reference only.
Copyright © 2008 Cramster, Inc.