The use of scanf seems a reasonable method.
But be careful when trying this
if(atof(tabela) == NULL)
My compiler rejects this line as an error:
[Error] invalid operands to binary == (have 'double' and 'void *')
Even if the compiler accepts it, if the input file contains any number which is zero, then
will result in zero, therefore this test cannot distinguish between a valid number "0" or some other text "abc".
|i have a problem why printf prints -99999 instead of firsttext and the same with secondtext|
besede[stevecBesed] = tabela;
is simply copying the address of tabela to the array. If the contents of tabela changes, so does the data pointed to by besede[stevecBesed].
That could be fixed like this, change the array definition to allocate space for the contents of the string
and use this to copy the string to the array:
strncpy(besede[stevecBesed], tabela, 20);
as for the numeric values,
stevila[stevecStevil] = atof(tabela);