#include <stdio.h>
int stringLength (char *text)
{
  int count = 0;
  while (*text != '\0')
  {
    count++;
    text++;
  }
  return count;
}
int main()
{
  char str[25];
  int length;
  printf("ENter string: ");
  scanf("%s", &str);
  length = stringLength(str);
  if (length > 25)
  {
    printf("Invalid\n");
    printf("Enter string: ");
    scanf("%s", &str);
  }
  printf("Your string is: %s and its %d long", str, length);
  return 0;
}
If the first input is wrong (over 25) it will remember that number (length) and when I input another string it will add the numbers together. How do I fix it so it goes from beginning? So it counts the next string from start?
 
     
    