#Bug#
Bug
You write to flags
, but you never allocate any space for it. If you had turned on full compiler warnings, it would have warned you about that.
#Use ints, not strings#
Use ints, not strings
Part of the reason your program is so slow is that you keep all of your values in strings instead of ints. Then you use atoi()
to convert the same strings over and over. Just convert your numbers once and then keep them in int
format for later reuse.
#Massive allocations#
Massive allocations
Your program also allocates one string per permutation (i.e. the family
array). You never use the old permutations, so you should just have one permutation buffer and overwrite it instead of allocating new buffers all the time.
#Bug#
You write to flags
, but you never allocate any space for it. If you had turned on full compiler warnings, it would have warned you about that.
#Use ints, not strings#
Part of the reason your program is so slow is that you keep all of your values in strings instead of ints. Then you use atoi()
to convert the same strings over and over. Just convert your numbers once and then keep them in int
format for later reuse.
#Massive allocations#
Your program also allocates one string per permutation (i.e. the family
array). You never use the old permutations, so you should just have one permutation buffer and overwrite it instead of allocating new buffers all the time.
Bug
You write to flags
, but you never allocate any space for it. If you had turned on full compiler warnings, it would have warned you about that.
Use ints, not strings
Part of the reason your program is so slow is that you keep all of your values in strings instead of ints. Then you use atoi()
to convert the same strings over and over. Just convert your numbers once and then keep them in int
format for later reuse.
Massive allocations
Your program also allocates one string per permutation (i.e. the family
array). You never use the old permutations, so you should just have one permutation buffer and overwrite it instead of allocating new buffers all the time.
#Bug#
You write to flags
, but you never allocate any space for it. If you had turned on full compiler warnings, it would have warned you about that.
#Use ints, not strings#
Part of the reason your program is so slow is that you keep all of your values in strings instead of ints. Then you use atoi()
to convert the same strings over and over. Just convert your numbers once and then keep them in int
format for later reuse.
#Massive allocations#
Your program also allocates one string per permutation (i.e. the family
array). You never use the old permutations, so you should just have one permutation buffer and overwrite it instead of allocating new buffers all the time.