What would be considered better code? (in C)

  • Thread starter Thread starter Monado_III
  • Start date Start date
  • Views Views 1,218
  • Replies Replies 3

Monado_III

Well-Known Member
Member
Joined
Feb 8, 2015
Messages
722
Reaction score
435
Trophies
1
Location
/dev/null
XP
1,495
Country
Canada
Out of these two examples, what would be considered better code, in terms of readability and what is generally considered good practice (and why)? They do the same thing minus one or two formatting things that I'm sure I could work out with enough google searches. (I made isgraph1.txt and isgraph.txt was taken from a book and intentionally cut the comments out)
 

Attachments

Last edited by Monado_III,
The case switch is usually faster, as you only end up putting the variable to be compared in the stack once, instead of once for each IF comparison.
 

Site & Scene News

Popular threads in this forum