C-language small function--find the longest number of __ function

Source: Internet
Author: User

Function Prototypes:
Unsignedint Continumax (char** poutputstr, char* intputstr)

Input parameters:
char* intputstr input string;

Output parameters:
char** Poutputstr: The longest consecutive number string, if the length of the longest serial number string is 0, should return an empty string; If the input string is empty, you should return an empty string;
Here is the code that you implemented

#include <stdio.h> #include <Windows.h> #include <ctype.h> int Countmax (char *outputstr, char*
    INTPUTSTR) {Char *in = intputstr, *out = Outputstr, *temp, *final;
    int count = 0, maxlen = 0; while (*in!= ' ") {if (*in >= ' 0 ' &&*in <= ' 9 ') {for (temp = in; *in > = ' 0 ' && *in <= ' 9 ';
                in++) {count++;
                printf ("*in:%c", *in);
            printf ("Count%d\n", count);
            } else {in++;
        Count = 0;
            } if (MaxLen < count) {MaxLen = count;
            Count = 0;
        final = temp;;
        for (int i = 0; i < MaxLen; i++) {*out = *final;
        out++;
    final++;
    } *out = ' I ';
return maxlen;
    int main () {char *in = ' as2132asd54sa10322 ';
    Char out[100];

    int Len;
    Len = Countmax (out,in); Printf("%d%s", len,out);
    System ("pause");
return 0; }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.