You can't use strlen() ... why not? It's a standard C library function...
I suppose you could write your own version. All strlen() does is loop through a string looking for the null character at the end. Should be easy enough to duplicate...
Code:
#include <stdio.h>
#define MAX 100
int main( int argc, char *argv[]) {
char s[MAX];
int i, j=0;
// char c;
printf("Enter a string\n");
fgets(s, MAX, stdin);
for(i =0; i<MAX; i++ ) {
if (s[i] == null) // exit when null found
{ j = i;
break; }
}
j = (j == 0) ? Max : j; // return MAX if no null
printf("The repetition of this line is:");
puts(s);
printf("The length is %d.\n", j);
return 0; }