IT Community - Software Programming, Web Development and Technical Support

How can do test the Pointers & Structures?

This is a discussion on How can do test the Pointers & Structures? within the Software Testing forums, part of the Software Quality Assurance category; Hi, Any one Explain. Thanks, Sundar Raja...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Quality Assurance > Software Testing

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 07-24-2007, 04:33 AM
sundarraja sundarraja is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 174
sundarraja is on a distinguished road
Question How can do test the Pointers & Structures?

Hi,

Any one Explain.

Thanks,
Sundar Raja
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 07-30-2007, 09:54 PM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 881
kingmaker is on a distinguished road
Send a message via MSN to kingmaker
Arrow Re: How can do test the Pointers & Structures?

we can test whether the pointer is currently valid by checking if it's not equal to the null pointer, or contrariwise, we can test whether it's invalid by checking if it's equal to the null pointer.
if(p != NULL)
Furthermore, if you write the test if(p != NULL), it does not in the general case mean ``is p valid?''. The test if(p != NULL) can only be used to mean ``is p valid?'' if you have taken care to make sure that all non-valid pointers have been set to null.

(There is one condition under which C does guarantee that a pointer variable will be initialized to a null pointer, and that is when the pointer variable is a global variable or a member of a global structure, or more precisely, when it is part of a variable, array, or structure which has static duration.)

Remember, too, that the shorthand form

if(p)

is precisely equivalent to if(p != NULL). So you may be able to read if(p) as ``if p is valid'', but again, only if you've ensured that whenever p is not valid, it is set to null.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Control Structures Falcon PHP Programming 12 07-02-2008 12:17 AM
looping structures in Ruby? vadivelanvaidyanathan Ruby 1 08-18-2007 12:53 AM
What is the difference between structures and enumeration? anbuchezhians VB.NET Programming 1 07-28-2007 12:50 AM
declare an array of N pointers to functions returning ? sundarraja C and C++ Programming 0 07-25-2007 03:58 AM
Difference of Structures and Classes vigneshgets C and C++ Programming 1 05-24-2007 10:53 AM


All times are GMT -7. The time now is 02:05 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0