affichage inverser d'un tableau
bonsoir tous ,
je voudrais saisire un tableau de caractere en utlisant la fonction malloc , et l'afficher de manniere inverse
exemple
en entrer:
mot 1 : develo
mot 2 : meilleu
en sorti:
mot 1:meilleur
mot 2 : develo
je repete je veux just l'affichage, merci
voila extrai de mon code mais malheuresement ca ne marche pas
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
#include<string.h>
#include<stdio.h>
void input()
{
char *t[2];
int i;
for(i=0;i<2;i++)
{
t[i]=(char*)malloc(sizeof(char)*100);
printf("mot:");
gets(t[i]);
}
for(i=2;i<0;i--)
{
printf("le %d mot %s\n",i,t[i]);
}
getch();
}
int main()
{
input();
return 0;
} |