i am trying to compare 2 strings of characters The users input containing 5 chars is compared to a table If the input is already be existent in the table the index of those chars in the table is printed Quest: how to copy the result of a printf() into an array ? The last printf() gives a sequence of numbers and I am trying to save that sequence to another array for further operation ! I have not been able to do that so far even with tmp[]=i ;
Code:
#include <stdio.h>
#include <string.h>
#define N 30
#define n 100
int main (void)
{
int i,z;
int total_chars = 0;
char seq[N],c;
int tmp[13];
char Table[] = {'z','c','C','d','D','e','f','F','g','G','a','A','h','c'
,'C','d','D','e','f','F','g','G','a','A','h','c'
};
for ( i=0 ; i<13; i++)
{
c=getchar();
seq[i]=c;
printf( "your input %c\n" , seq[i]);
if(seq[i] == '0')
{
total_chars = i;
break;
}
}
for(z=0 ; z<13 ; z++ )
{
for (i=0; i<13; i++)
{
if (seq[z]==Table[i])
// seq[z]=i;
printf("\n%d",i); // here i get a sequence of numbers the question is how can i copy this sequence to an array and the print the array out ?
}
}
return 0;
}