Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Why segfault and no NULL match in for loop?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Default User, post: 2873677"] [i][i] When will your conditional ever be true? Those character arrays can NEVER be NULL. You need to add another "blank" array entry, and test for an empty string or something. for(i=0; mystruct[i].field1[0] != '\0'; i++) { [i][i][i] Well, yeah. NULL is not a string, and passing a null pointer to most of the string-handling routines causes undefined behavior. To test for a null pointer (which you can't have), use equality. Try adding: Brian[/i][/i][/i][/i][/i][/i] [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Why segfault and no NULL match in for loop?
Top