I am trying to count a char*, but my looping never stop until it reach the last part of memory allocation...?
Here's what I mean:
char* text1 = "Hello Guys!";
char* text2 = "i dont know why";
char* text3 = "Hello World";
int counter = 0;
for(char* temp = text1;temp != '\0';)
//then i printed Counter
temp is a pointer and it won't be equal to
'\0', which is 0, in the loop.
To access to the character pointed at by that, use