Hi,
I am writing a parser code for the following format received:
STX | CMD1|CMD2|DATA_LEN|DATA| ETX |
Each 1 byte in len
There are approximately 100 such unique Commands. And the data will vary based on the datalen, which also needs to be parsed.
Coming to the problem:
1. What is the adavantage of an if else over the switch case, besides the code readablity.
I mean in terms of efficiency and memory consumption as memory is limited in my case a mere 92Kb.
2. Is it optimal to use switch and case statements for each Command.
ie, 100 commands = 100 cases.
3. Is it optimal to use function pointers for the same.
Thanks to all