#include<stdio.h>
#include<stdlib.h>
main(){
char *tab;
int n;
int i;
char c;
printf("dimension du tableau?");
scanf("%d",&n);
tab=(char*)malloc(n*sizeof(char));
printf("remplir le tableau :");
fflush(stdin);
gets(tab);
for(i=0;tab[i]!='\0';i++){
printf("%c",tab[i]);
}
}
let's say i just want 5 letters in tab,so i run the program and put n=5,but what i don't get is that if i entered more then 5 letters the program continue workin without any error+memorize these letters in tab...isn't it supposed to stop on 5 letters or at least don't memorize these plus letters?
plz help me and thnx