"Regarding the function pal that I asked in ""I don't know what function to do", I used a pointer for the function, but if I were to write it without a pointer, I thought it would look like the following, so I got an error."What's wrong with you?
intpal(chars[])
{
inti;
chat[i] = s;
while(t[i]!='\0'){
t++;
}
t--;
while(s<=t){
if(s[i]!=t){
return 0;
}
s++;
t--;
}
return1;
}
There are many mistakes.
A value of 1i is neither initialized nor incremented.
It's called two arrays, but it's not an array index, it's increasing the pointer.
3 The first t is misconfigured.
4 Compare the pointer to the value indicated by the pointer (the i-th value of the array). (Assume t is the pointer)
and so on.
I think it's meaningless to write the answer, so I pointed out something that I think is wrong.
It is recommended that you focus on "what is the same thing and what is different about pointer variables and arrays.
Here are some tips:
The array name represents an address and cannot be rewritten to another address.
As a guess, the person who asked me may remember the array in the execution statement in the form of array [additional letter]
.
In the execution text, the array name [accompanies]
indicates the ではarray element 」 of the location indicated by the subscript, not the array.
I think you should understand the difference between array and array elements.
Array elements are rather the same as variables and can be modified.You cannot change the address indicated by the array name.
The array name represents an address and cannot be rewritten to another address.
As a guess, the person who asked me may remember the array in the execution statement in the form of array [additional letter]
.
In the execution text, the array name [accompanies]
indicates the ではarray element 」 of the location indicated by the subscript, not the array.
I think you should understand the difference between array and array elements.
Array elements are rather the same as variables and can be modified.You cannot change the address indicated by the array name.
© 2024 OneMinuteCode. All rights reserved.