If i have a function api that expects a 14 digit input and returns a 6 digit output. I basically define the input as a const char *. would that be the correct and safe thing to do?
also why would I not want to just do char * which I could but it seems more prudent to use const char * in that case especially since its an api that i am providing. so for different input values I generate 6 digit codes.
If i have a function api that expects a 14 digit input and returns
Share
When you say
const char *cyou are telling the compiler that you will not be making any changes to the data thatcpoints to. So this is a good practice if you will not be directly modifying your input data.