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 links from elsewhere to this Post. Click to view. #1 (permalink)  
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
Sponsored Links
  #2 (permalink)  
Old 07-30-2007, 09:54 PM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo 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.
__________________
The KINGMAKER
Makes Every Thing Possible

Stuffs (My Blog)
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 On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/software-testing/2644-how-can-do-test-pointers-structures.html
Posted By For Type Date
Discussweb IT Community - Web Development, Software Programming, SEO, Quality Assurance, 3D, Web Hosting and more... This thread Refback 07-24-2007 11:48 PM

Similar Threads
Thread Thread Starter Forum Replies Last Post
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
How can I allocate arrays or structures bigger than 64K? vadivelanvaidyanathan C and C++ Programming 1 07-17-2007 02:33 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 12:34 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0