Hi @afpaiva
! Thank you for your question!
In comparison with if/else statements, switch statements are a bit faster with small number of cases and get incrementally faster with new conditions. Readability, it seems that devs prefer to read if/else for two conditions and then switches for more.
There's this great table from O'reilly:
Talking about performance in C is both beyond my expertise and comfort level, sadly!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi @afpaiva ! Thank you for your question!
In comparison with
if/else
statements,switch
statements are a bit faster with small number of cases and get incrementally faster with new conditions. Readability, it seems that devs prefer to readif/else
for two conditions and thenswitch
es for more.There's this great table from O'reilly:
Talking about performance in C is both beyond my expertise and comfort level, sadly!