Another thing lionannesh following things you need to take care

1 Remember = and == are not the same.In your if statement you use = this would assign the variable a value whereas == checks if two values are equal.
2 When setting a flag dummy try to use 1 for on and 0 for off this makes it easier to understand don't use any arbitrary value
3 When passing arrays try to use pointers.It's much more easier