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

int main(void) {
    // Read lines using POSIX function getline
    // This code won't work on Windows
    char *line = NULL;
    size_t len = 0;
    
    while(getline(&line, &len, stdin) != -1) {
       printf("line length: %zd\n", strlen(line));
    }
    
    printf("\n\nMax line size: %zd\n", len);
    
    free(line);     // getline will resize the input buffer as necessary
                 // the user needs to free the memory when not needed!
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: