#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<malloc.h>
#define MAX 100
int main()
{
char*str;
int i,test,l;
scanf("%d\n",&test);//always give (\n) after scanf when using gets,puts,fgets,fputs
for(i=0;i<test;i++)//you had made mistake their should be test you had given 't'
{
str=(char*)malloc(sizeof(char)*MAX);
fgets(str,MAX,stdin);
l=strlen(str);
puts(str);
printf(" %d\n",l);
free(str);
}
return 0;
}
Run above code it will run.
for run on compiler http://code.geeksforgeeks.org/h1AiYY