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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
#include <stdio.h>
#include <stdlib.h>
#define max_index 6
#define element 5
//char info[30] = {'D','1','0',',','0','7','F','D','2',',','3','F','\0'};
char info[30] = "D12,25FD12,55F11,89FD12,3F";
char t[max_index][element];
size_t j,i;
size_t Number_index = 0; // Number index of table
size_t N = sizeof(t) / sizeof(t[0]);
size_t M = sizeof(t) / sizeof(t[j][0]);
void readandparse(char * pointer)
{
char data;
int k;
for(k = 0; pointer[k] != 0; k++)
{
data = pointer[k];
if(data == 'F')
{
printf("Reception du caractere: F!\n");
}
else if(data == 'D')
{
printf("Reception du caractere D: !\n");
}
else
{
// Parcourons les indices du tableau de
// t[0] a t[max_index - 1]
for(j = 0; j < N; j++)
{
// Pour chaque element t[j] du tableau,
// ecrivons les donnees dans t[j]
//de t[j][0] a t[j][element - 1]
for(i = 0; i < M; i++)
{
t[j][i] = data; // Write data into string with two dimensions
printf("%s", t[j][i]);
}
printf("\n");
}
}
}
}
main()
{
readandparse(info);
return 0;
} |
Partager