I'm currently completing some homework where we read an input, and load the input into a string, and stop reading when certain conditions are not met.
I've now been prompted to re-write my line 5 to involve pointer arithmetic, without square bracket notation.
int readLine(char*s, int MAX){
char c;
int i = 0;
while((c = getchar()) != '\n' && i<MAX){
s[i++] = c;
}
s[i]= '\0';
return i;
}
would it be *s = i;?