Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #include <stdio.h>
- #include <stdlib.h>
- // by xgeek
- void main() {
- char *chaine;
- char format[50];
- int taille;
- printf("Taille: ");scanf("%d",&taille);
- chaine = calloc(taille + 1,sizeof(char)); // allocation dynamique
- sprintf(format,"%%%ds",taille);
- scanf(format,chaine);
- printf("%s\n",chaine);
- free(chaine);
- }
Add Comment
Please, Sign In to add comment