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

Pages: 1-

So I heard you guys would do my C homework.

Name: Anonymous 2008-11-25 9:34

Am I correct?

Name: Anonymous 2008-11-25 9:59

Indeed, we'll do your C homework in Haskell.

Name: Anonymous 2008-11-25 10:52

Just post it, and we'll post a solution. It won't necessarily be the solution to your specific problem, but better than nothing, right?

Name: Anonymous 2008-11-25 11:08

Just post it, and we'll post a solution series of ENTERPRISE-QUALITY memes. They won't necessarily be the solution to your specific problem, but better than nothing, right?

Name: Anonymous 2008-11-25 11:14

I have to write "Hello World!" to the command prompt, how?

Name: Anonymous 2008-11-25 11:32

Here's the program:
#include <stdio.h>

int main (int argc, char ** argv) {
    printf("Hello World!\n");
    return 0;
}


Here's a step by step explanation:

#include <stdio.h>
This statement lets the compiler know about the standard input/output functions (e.g. reading and writing to command prompt, reading and writing to files).  Without it, the compiler won't recognize these functions and will not be able to use them.

int main (int argc, char ** argv)
This is the signature of the main function.  The first word, int, indicates that this function returns an integer (I'll explain why later).  The second word, main, gives the name of the function.  Every C program must have a main function,  that's where the program starts.    The two things in parentheses are parameters.  They're the information given to function.  For main, the operating system always passes two parameters to it, argc and argv.  Together they represent the command line arguments to the program when run from the command prompt.  It isn't really something you need to worry about now, just remember to put them in when you write main.

{

}

The braces indicate that the code which they surround is the body of the thing immediately preceding them.  So the code in the braces is the body of main.

printf("Hello World!\n");
printf is C's command prompt writing function.  It takes a string (series of letters) and prints it.  It can also take variables and print them, but you don't need to worry about that yet.  Also, notice the \n?  That simply creates a new line.  Without it, when someone runs your program, this will happen:
C:\blah\>hello.exe
Hello World!C:\blah\>

Doesn't look very good, does it?  Remember to terminate output with a new line!

return 0;
Remember earlier when I said that main returns an integer?  This is it.  The operating system wants to know whether the program completed successfully or not, so we return an integer code to it.  0 is success, any other number is failure.  Usually we choose one number for each potential point of error, so that if there is a problem we can look at the number and find out what the error is.  But a program this simple shouldn't have any errors so no need to consider that sort of thing.

If you have any other questions feel free to ask :-)

Cheers,
Anonymous of /prog/

Name: Anonymous 2008-11-25 11:33

Name: Anonymous 2008-11-25 12:36

>>6
Obviously you didn't run the program. cmd.exe puts a new line for you.

Name: Anonymous 2008-11-25 12:48

>>6
I'M EXIT_SUCCESS
SON OF A BITCH 0
0 IS PIG
DO YOU WANT POSIX
DO YOU WANT ANONIX PROGRAMMING GUIDELINES
KERNIGHAN IS FUCKING DISGUSTING
RITCHIE IS A MURDERER
FUCKING K&R

Name: Anonymous 2008-11-25 13:23

>>8
Learn something new every day.

Name: Anonymous 2008-11-25 13:54

Of course
>>6
shows how 'C' puts 4 lines of ceremony and one of legibility around the one line of "do what I want".

Name: Anonymous 2008-11-25 14:29

>>11
puts
nice pun xD

Name: Anonymous 2008-11-25 16:10

>>9
Worst KOREAN clone ever. Damn you people, what's up with your meme pasting skills? Learn the fucking right version:

I'M <adjective>
SON OF A BITCH <name>
<name> IS PIG
DO YOU WANT <feature 1>?
DO YOU WANT <feature 2>?
<name> IS PIG DISGUSTING
<full person name> IS A MURDERER
FUCKING <alternative name>

Name: Anonymous 2008-11-25 16:18

in the unambiguous mathematical form of Scheme:

(lambda (a b c d e f)
  (string-append "I'M " a "\nSON OF A BITCH " b "\n" b " IS PIG\nDO YOU WANT " c "\nDO YOU WANT " d "\n" b "IS PIG DISGUSTING\n" e " IS A MURDERER\nFUCKING " f))

Name: Anonymous 2008-11-25 17:38

>>13
I'M <adjective>
I AM <noun>
There, I fixed it for you.

Name: Anonymous 2008-11-25 19:26

hello, real OP here (check the address if you want)

the homework involves C and POSIX system calls, signals, and whatnot.

Name: Anonymous 2008-11-25 21:28

I have checked the address. This is not the op ;)

Name: Anonymous 2008-11-26 15:20

The pleasure of being cummed inside

Name: Anonymous 2008-11-26 15:21

The pleasure of being cummed inside

Name: Anonymous 2008-11-27 5:28

echo Hello World!

Name: Anonymous 2008-11-27 7:26

>>17

yes I am, lol

anyhow... let's see if I can explain properly

as I said before, I need to use C with linux POSIX functions and stuff to define and share memory and semaphores.

two programs: anonymous and mods

'anonymous' allows persons to talk to mods. if there is a mod, communication is established

'mods' allows a mod to establish communication with anonymous, one at a time.

The communication between the anonymous and mods programs is done through shared memory. It is suggested that the communication takes place in alternating order, ie:
The program anonymous reads a line of stdin (using fgets), puts it into memory (using the size of fgets), then mods program reads the information via shared memory and writes it to its stdout. Then, 'mods' reads a line of stdin, puts it in shared memory and program 'anonymous' reads the information via shared memory and writes it to its stdout, and so on. Users of any of the programs may indicate who want to end the communication through the indication of end of file.
These programs should include the concurrent implementation of various 'mods' programs and various 'users' programs.

Name: Anonymous 2008-11-27 7:34

gonna give an example:

zsh$ anonymous
"What is your anonymous reference?"
6969
"waiting for connection"
"connected with Moot"
Moot help me out
"I want to be the little girl"
Dude ur fucking useless
"I know lol"
sigh

zsh$ mods
"talking with 6969"
"Moot help me out"
I want to be the little girl
Dude ur fucking useless
I know lol
sigh
(...)
"talking with 10821"

Name: Anonymous 2008-11-27 7:38

Moot is not useless you moron.
protip: if somebody is being an insufferable faggot, please e-mail me.

love, mootykins

[http://zip.4chan.org/tg/res/3052712.html]

Name: Anonymous 2008-11-27 7:48

Sounds trivial. Either use mmap[1] or a subset of System V IPC[2], assuming you are running a kernel which supports these features. You could probably come up with a solution just by searching Google for five minutes.

___
[1] - http://www.gnu.org/software/libc/manual/html_node/Memory_002dmapped-I_002fO.html
[2] - http://tldp.org/LDP/lpg/node21.html#SECTION00740000000000000000

Name: Anonymous 2008-11-27 7:49

>>23
Moot is a fucking dickbutt. He never posts in the boards I visit, and probably doesn't even give a damn that his whole site is slow like a snail these days.

Name: Anonymous 2008-11-27 7:50

>>23
You must be new.
Every time moot tries to do something, things change from bad to worse.

Name: Anonymous 2008-11-27 8:09

The Pleasure of Being Cummed Inside

Name: Anonymous 2008-11-27 8:21

>>24

using mmap, semaphores... but it's kind of difficult doing this without previous background. my teacher is like "I assume you all know this".

Name: Anonymous 2008-11-27 10:44

The pleasure of being cummed inside

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