Horje
longest word in string in c Code Example
longest word in string in c
#include <stdio.h>

int main() {
    char string[100] = "Hello Kurnool";
    int i, start = 0, longest = 0, longest_pos = 0;

    for (i = 0; string[i] != '\0'; i++) {
        if (string[i] == ' ') {
            start = i + 1;
        } else {
            if (i - start > longest) {
                longest = i - start;
                longest_pos = start;
            }
        }
    }    
    printf("longest word: %d letters, '%.*s'\n",
           longest, longest, string + longest_pos);

    return 0;
}




Whatever

Related
Free robux 100 Code Example Free robux 100 Code Example
ip banned message Code Example ip banned message Code Example
dpy run code Code Example dpy run code Code Example
mybatis plus version Code Example mybatis plus version Code Example
__contains__ Code Example __contains__ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7