title: In C , what can I use instead of strlen if I don't want to use a string function?
body: <p>I recently started learning basic C and I am still noobie with it, I started doing some projects for learning and I am using library functions but I am interested in other methods...</p>
  <p>So I have an email validation, it works fine, but I want to do it without <code>strlen</code>, any suggestion what can I do instead of <code>strlen</code>?</p>
  <pre><code>void mail(char e[]) {
      int count = 0;
      int countb = 0;
      int i, j;
      int t, t2;
      int p = 0;
  
      for (i = 0; i &lt; strlen(e); i++) {
          if (e[i] == '@') {
              count++;
              t = i;
          }
      }
      if (count == 1) {
          for (j = 0; j &lt; t; j++) {
              if (!(e[j] == '_' || e[j] == '.' || isalpha(e[j]) || isdigit(e[j]))) {
                  p = -1;
                  printf(&quot;\nwrong\n&quot;);
                  break;
              }
          }
          if (p == 0) {
              for (i = t; i &lt; strlen(e); i++) {
                  if (e[i] == '.') {
                      t2 = i;
                      countb++;
                  }
              }
              if (countb == 1) {
                  for (i = 0; i &lt; t2 &amp;&amp; i &gt; t2; i++) {
                      if (!(isalpha(e[i]))) {
                          p = -1;
                          printf(&quot;\nwrong\n&quot;);
                          break;
                      } else {
                          p = 1;
                      }
                  }
                  if (p == 1) {
                      if (e[t2 + 3] != '\0') {
                          p = -1;
                          printf(&quot;\nwrong\n&quot;);
                      }
                  }
              } else {
                  p =- 1;
                  printf(&quot;\nwrong\n&quot;);
              }
          }
      } else {
          p = -1;
          printf(&quot;\nwrong\n&quot;);
      }
      return;
  }
  </code></pre>