Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

halp

Name: Anonymous 2013-04-21 12:02

what's wrong with this piece of C code /prog/?

#include <stdio.h>
int main (int argc, char *argv[])
{
        printf("%s %s %s \n",argv[1],argv[3],argv[5]);

        return 0;
}

Name: Anonymous 2013-04-21 12:28

If it ain't Lisp...

Name: Anonymous 2013-04-21 12:31

depends what its supposed to do. right now it prints the 1st, 3rd and 5th command line argument separated by spaces assuming you supply at least 5 arguments, otherwise behavior is undefined, is that what you want?

Name: Anonymous 2013-04-21 12:51

>>3
This person uses C/C++ in 21st century. I strongly doubt he knows what he wants.

Name: Anonymous 2013-04-21 14:09

(define (fprog grunnur)
  ((display (cddddr grunnur))
   (display " ")
   (display (caddr grunnur))
   (display " ")
   (display (car grunnur))
   (newline)))
(define x (list 1 2 3 4 5))
x
(fprog x)


I don't know how to get it to do the newline before the numbers or how to get it to display the 5th item without the parens around it but I also don't know how to Scheme.

Name: Anonymous 2013-04-21 14:17

It's fucking terrible and doesn't check for the number of arguments before trying to print them. Now go back to /g/

Don't change these.
Name: Email:
Entire Thread Thread List