What does this C program do, and how does it do it? http://ideone.com/s1maB
it does runtime error
don't you get same?
It's not a runtime error if you use in on your own computer.
IDEone yields a runtime error because the function writes an image to file.
ok, sorry for stupid question :/
This program has some errors: 1. unsigned int *d = (void*)data; should be replaced with unsigned int *d = (unsigned int*) data; 2. scale[i] = 1 / (1 + sqrt(i + 1)); scale_u[i] = scale[i] / sqrt(i + 1); should be replaced with scale[i] = 1 / (1 + sqrt((double)(i + 1))); scale_u[i] = scale[i] / (sqrt((double)(i + 1))); 3. w = 1./sqrt(i); should be replaced with w = 1./sqrt((double)i); Now the program will compile without any error or warning (I tested it on Visual Studio 2010 Professional).
Output is this: http://pastebin.com/pGMfzMZD The program is generating garbage string....... for further information. i will have to go through this program deeply......(My exams are going now, sorry)
It's not a garbage string; open it with an image viewer :-P
On gcc with -Wall and the other annoying stuff toggled on, it only gave me warnings for the unused argc and argv, and the attached image is output:
It looks funny though :( supposed to me... solid but with shadows all over it and not weird looking :( fix it.
with which image viewer it should be opened??
I don't know which one in particular, but I personally use irfanview: http://www.irfanview.com/
I'm not really familiar with that .pgm format it wrote though : http://netpbm.sourceforge.net/doc/pgm.html
better use Coly Photo Viewer
Join our real-time social learning platform and learn together with your friends!