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
Need sharp criticism on my code.
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="Ben Bacarisse, post: 4066950"] First off, it's not an invariant. I think a confusion between loop conditions and loop invariants has crept into another thread and you maybe picked up the term from there. Anyway, I assume you mean the loop condition. It is indeed not correct. For one thing it looks like you want to stop the loop when you see a null pointer, but your arrays don't end with one. You should write: char *exceptions[] = { "exception1", "exception2", "exception3", NULL }; The pointers in the array are simply exceptions[0], exceptions[1] .. exceptions[3] No need for ** or adding to a pointer (yes, X[I] means *(X+I) but the [] notation is there to be used). I presume the puts is from some testing you were doing. The match_any function would return true (1) as soon as buff is seen to contain exceptions[i] as a substring (using strstr). It would return false (0) if the loop ends without have seen any such match. You're welcome.[/i][/I] [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Need sharp criticism on my code.
Top