every time a computer stores a string in memory, for example the word 'apple', it's not using 5 characters, it's using 6 characters, 'a','p','p','l', 'e' + 'null'
therefore putting 00000000 aka '\0' in the last byte.
so here is the code that would work in c:
// assuming string A = 'apple'
int count = 0;
while (A[count] != '\0')
{
n++;
}
so i tried the following code in python, it did not work, what went wrong?
A = 'apple'
count = 0
while A[count] != '\0':
count+=1
print(count)
Note: the point here is not to get the length, the point is how do i get the length using while != 00000000
Additional Note: how does python store strings in memory, does it put 00000000 in the end like c does? if it doesn't ,lets say i put a 00000000 in memory using c, then how do i find that 00000000 in memory with python?