Given the following function in c:
int reset_values_of_string(char* s, int to_new_val){
int l = strlen(s);
int was_changed = 0;
for(int i=0; i<l; i++) {
if(s[i] != to_new_val) was_changed=1;
s[i] = to_new_val;
}
return was_changed;
}
Can I write this function as MACRO (#define) in C? that will do exactly the same and will return this value ?
In addition, what is bascially preferred? to implement it with macro or with function like that i write it above.