I wanted to be cool, but instead i became retard
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BUFSIZE 128
int main(int argc, const char* argv[])
{
char readbuf[BUFSIZE];
int x = 0;
printf("Please Enter some rand string of char?\n");
do {
fgets(readbuf, BUFSIZE, stdin);
if(strcmp(readbuf, "\n")){
x = 1;
} else {
printf("Please, enter a valid string.\n");
}
} while(x == 0);
printf("The lenght of your string devided by 2 is %lu,"
" and the overall lenght is %lu.\n", strlen(readbuf)/2, strlen(readbuf));
return 0;
}
Comments