Ask your own question, for FREE!
Computer Science 17 Online
OpenStudy (anonymous):

What does this C program do, and how does it do it? http://ideone.com/s1maB

OpenStudy (anonymous):

it does runtime error

OpenStudy (anonymous):

don't you get same?

OpenStudy (anonymous):

It's not a runtime error if you use in on your own computer.

OpenStudy (anonymous):

IDEone yields a runtime error because the function writes an image to file.

OpenStudy (anonymous):

ok, sorry for stupid question :/

OpenStudy (anonymous):

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).

OpenStudy (anonymous):

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)

OpenStudy (anonymous):

It's not a garbage string; open it with an image viewer :-P

OpenStudy (anonymous):

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:

OpenStudy (anonymous):

It looks funny though :( supposed to me... solid but with shadows all over it and not weird looking :( fix it.

OpenStudy (anonymous):

with which image viewer it should be opened??

OpenStudy (anonymous):

I don't know which one in particular, but I personally use irfanview: http://www.irfanview.com/

OpenStudy (anonymous):

I'm not really familiar with that .pgm format it wrote though : http://netpbm.sourceforge.net/doc/pgm.html

OpenStudy (anonymous):

better use Coly Photo Viewer

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!