Hey there,
i tried to solve the MUL Problem by having an array of long long and then doing normal school method on it with base 10^9 (i know there's karatsuba and FFT and so on ... but i've read that also this approach can be accepted)
I used normal C (gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5)
As i need a%10^9 and a/10^9 anyway i thought i can use the lldiv-function of stdlib.h (see man div)
Now i get this compilation error:
error: 'lldiv_t' undeclared (first use in this function)
I thought this type (it's a struct) is DEFINED BY stdlib.h (which of course i included)?
On my machine, everything compiles perfectly with gcc -std=c99 (even without the -std=c99 switch - just more warning - but it compiles and runs!)
So what could be the problem? Also, the SPOJ compiler does not complain about the function lldiv but ONLY about the type lldiv_t (which just IS the return type of lldiv ...)
Something else what makes me curious is this warning i always get (although i include stdio.h)
warning: implicit declaration of function ‘fgets_unlocked’
Why do i get this warning? How can i get rid of it? I don't get the warning if i use normal fgets.
Big thanks for any help 
Cheers
Edit: could it be that this gcc on SPOJ still compiles with -std=c89 ? - Why should this be the case? I know that lldiv_t belongs to the C99 Standard. But still: why does it compile perfectly on my machine and not here? - Maybe a problem with glibc? This is my version:
lib/libc.so.6
GNU C Library (Ubuntu EGLIBC 2.12.1-0ubuntu9) stable release version 2.12.1, by Roland McGrath et al.
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.4.5.
Compiled on a Linux 2.6.35 system on 2010-11-09.
Available extensions:
crypt add-on version 2.1 by Michael Glad and others
GNU Libidn by Simon Josefsson
Native POSIX Threads Library by Ulrich Drepper et al
BIND-8.2.3-T5B
libc ABIs: UNIQUE IFUNC
Maybe this information helps? Help would really be appreciated!
As lldiv_t belongs to Stadard C99, which is -- self-explanatory -- a Standard, i think it should be compilable and accepted here, shouldn't it?
Or why should we use a 20 years old standard if there is a newer one?
Or could anyone of you tell me an alternative to lldiv (and lldiv_t)?
Please help me :mrgreen:
Thanks