Results 1 to 3 of 3

Thread: C Substring Function <Resolved />

Threaded View

  1. #1

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193

    Resolved C Substring Function <Resolved />

    Hello i have tried to write a substring function in C

    but it wont compile

    i still learning C but can someone help me get this working please

    PHP Code:

    #include <stdio.h>
    #include <string.h>

    typedef charstring;


    string substring(string haystack,int start,int length)
    {
    charsubstr;
    int ci;
      if (
    start strlen(haystack) || length strlen(haystack) || (start length) > strlen(haystack))
        {
          return(
    0);
        }
        else
        {
        
    0;
          for(
    c=start;c<(start length);c++)
            {
              
    substr[i] = haystack[c];
              
    i++;
            }
          return(
    substr);
        }

    Last edited by señorbadger; Oct 9th, 2004 at 11:33 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width