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

whats the purpose of this C function

Name: Anonymous 2007-09-12 5:22 ID:wfxixJ2g

Excuse my newfagedry

Consider the C code function below:
void qwerty(int *x, int *y, int size)
{
 int k=0;
 while ( k < size ) {
    *(x + k) = *(y + k);
    k++;
 }
}

i) What best describes the purpose of the function qwerty?

Name: Anonymous 2007-09-12 5:27 ID:a/fIFMHy

Do your fucking homewotk yourself, faggot.

Name: Anonymous 2007-09-12 5:27 ID:ACHJdM9S

It prints out 'Hello World'

Name: Anonymous 2007-09-12 5:27 ID:tXaAkcCM

copys the data starting at y into the data starting at x.

Name: Anonymous 2007-09-12 5:29 ID:a/fIFMHy

It opens an array of pointers and stores values in it. Mostly big ones, over 9000.

Name: Anonymous 2007-09-12 5:30 ID:ACHJdM9S

>>4 lol you are funny.
but seriously it prints out 'DONT HELP HOMEWORK FAGS'

Name: Anonymous 2007-09-12 5:30 ID:Heaven

It will print a memory image of existing pointers.

Name: Anonymous 2007-09-12 5:31 ID:Heaven

copies string literals to a defined pointer position

Name: Anonymous 2007-09-12 5:32 ID:Heaven

>>1
Here, written better

void qwerty(int *x, int *y, size_t size) {
    while(size-- != 0)
        x[size] = y[size];
}

Name: Anonymous 2007-09-12 5:32 ID:a/fIFMHy

embiggens two pointers so they can store themselves

Name: Anonymous 2007-09-12 5:33 ID:Heaven

It swaps the value of x and y.

Name: Anonymous 2007-09-12 5:34 ID:Heaven

it sorts two values based on their pointers

Name: Anonymous 2007-09-12 5:36 ID:Heaven

It creates a new array to store the value of y

Name: Anonymous 2007-09-12 5:37 ID:Heaven

qwerty(x, y, -1); amirite

Name: Anonymous 2007-09-12 5:37 ID:Y966Tl8v

I rike

hokay tankyu

Name: Anonymous 2007-09-12 5:38 ID:Heaven

it promotes shitty syntax amongs students of C

Name: Anonymous 2007-09-12 5:39 ID:Heaven

its an ad-hoc implementation of a 2-3-4 tree using a doubly linked list.

Name: Anonymous 2007-09-12 5:39 ID:Heaven

RECURSIVE, FUCK YEAH:

void qwerty(int *int, int *int2, int int3)
{
  qwerty(new int *&int,int2[int3],&int1);
}

Name: Anonymous 2007-09-12 5:41 ID:i9LZzsvu

Create function calld qwerty that hav no return value. It has three parameters: x (a pointer to an int), y (a pointer to an int) and size (an int).

In the function, a variable k of type int is declared. It is initialized with zero. While k is smaller than size, it does the following:

The value that is pointed to by the addition of x and k is set to the value that is pointed to by the addition of y and k.
k is incremented by one.

Name: Anonymous 2007-09-12 5:43 ID:Y966Tl8v

i smell a gaiafag

Name: Anonymous 2007-09-12 5:44 ID:tXaAkcCM

>>18
qwerty.c:1: error: expected ';', ',' or ')' before 'int'

Name: Anonymous 2007-09-12 5:52 ID:ACHJdM9S

void superqwerty(int *x, int *y, int size)
{
 int k(101);
 while(k>100)
 {
  if(k >=size) k=1;
  x[k]=y[k]
  k=rand();
 }
}

Name: Anonymous 2007-09-12 5:53 ID:Heaven

>>22
Wow, that runs really fast. I will show that to my teacher.

Name: Anonymous 2007-09-12 6:24 ID:tXaAkcCM

obfuscated version:

void qwerty(int*x,int*y,int size)
    {size!=0?x[size-1]=y[size-1],qwerty(x,y,size-1):0;}

Name: Anonymous 2007-09-12 6:35 ID:Heaven

because using the ternary operator with no indentation makes it obfuscated amirite?

Name: Anonymous 2007-09-12 6:46 ID:Heaven

obfuscated version:

void %&$&$%$&%$&%$%&ΩΩ%$&ΩΩΩ&%⅜&¤$⅝$&⅝
Ω$%$&§$%§$%§$%§$%§$&%$§&§%$&%&$&$§&$%§
$%&§%$&§%$§&%$§&$%§&%$§&%$§&%$&§%$&$%$
&%$%&$%$%$&%$&%$&%$@@%&$%$&%$Ω$&%&$&%$
Ω$%$&§$%§$%§$%§$%§$&%$§&§%$&%&$&$§&$%§
Ω$%$&§$%§$%§$%§$%§$&%$§&§%$&%&$&$§&$%§
$%&§%$&§%$§&%$§&$%§&%$§&%$§&%$&§%$&$%$
&%$%&$%$%$&%$&%$&%$@@%&$%$&%$Ω$&%&$&%$
Ω$%$&§$%§$%§$%§$%§$&%$§&§%$&%&$&$§&$%§
Ω$%$&§$%§$%§$%§$%§$&%$§&§%$&%&$&$§&$%§
$%&§%$&§%$§&%$§&$%§&%$§&%$§&%$&§%$&$%$
&%$%&$%$%$&%$&%$&%$@@%&$%$&%$Ω$&%&$&%$
Ω$%$&§$%§$%§$%§$%§$&%$§&§%$&%&$&$§&$%§
(int*x,int*y,int size)
{size!=0?x[size-1]=y[size-1],qwerty(x,
y,size-1):0;}

Name: Anonymous 2007-09-12 7:18 ID:EoObRv0X

People who consider the ternary operator obfuscated are pretty dumb

Name: Anonymous 2007-09-12 7:40 ID:tXaAkcCM

well, in my classes not leaving a space in an assignment is seen as  a ridiculous flight of fancy wrt readibility... so i couldn't really be creative

Name: Anonymous 2007-09-12 7:41 ID:Heaven

The obfuscated version doesn't work anyway.
fail by 1.

Name: Anonymous 2007-09-12 7:45 ID:a/fIFMHy

obfuscated version:



void qwerty(int *x, int *y, int size)
{
/*
Ludwig van Beethoven war der Sohn einer Musikerfamilie, deren väterliche Vorfahren (Bauern und Handwerker) aus Mecheln im flämischen Brabant kamen. Das „van“ im Namen zeugt nicht von adliger Herkunft, sondern zeigt die örtliche Herkunft an (wahrscheinlich die Landschaft Betuwe). Beethovens väterlicher Großvater, der gleichfalls Ludwig van Beethoven hieß, war kurkölnischer Kapellmeister in Bonn. 1740 wurde sein Sohn Johann geboren, der als Tenor in der Bonner Hofkapelle sang. Johann heiratete die aus Ehrenbreitstein stammende Maria Magdalena Keverich. Die Mutter L. v. Beethovens, Maria Magdalena Keverich, kam am 19. Dezember 1746 als Tochter eines kurfürstlichen Leibkochs in Ehrenbreitstein zur Welt; ihre Vorfahren stammten überwiegend von der Mosel. Mit knapp 16 Jahren wurde sie an einen Kurtrierer Kammerdiener namens Laym verheiratet. Sie gebar einen Sohn, der früh verstarb und mit 18 Jahren war sie bereits Witwe. Am 12. November 1767 vermählte sie sich in ihrer zweiten Ehe mit Johann van Beethoven. Aus dieser Ehe wurde zunächst am 2. April 1769 der erste Sohn Ludwig Maria van Beethoven getauft. Dieser starb nach sechs Tagen.

Am 17. Dezember 1770 wurde in der Remigiuskirche in Bonn ihr drittes Kind, der zweite Sohn in ihrer zweiten Ehe getauft und als „Ludovicus van Beethoven“ in das Taufbuch eingetragen. Der Geburtstag wird allgemein mit dem 16. Dezember 1770 angegeben, ist aber nicht dokumentarisch belegt. Sein Geburtshaus befindet sich in der Bonngasse 20. In dieser zweiten Ehe brachte Maria Magdalena Beethoven noch fünf weitere Kinder zur Welt, von denen nur die nächsten zwei überlebten und im Leben Ludwigs eine Rolle spielten. Diese waren seine Brüder Kaspar Anton Karl van Beethoven (getauft am 8. April 1774) und Nikolaus Johann van Beethoven (getauft 2. Oktober 1776).
*/
 int k=0;
 while ( k < size ) {
    *(x + k) = *(y + k);
/*
Beethovens Vater war von dem jungen Wolfgang Amadeus Mozart beeindruckt, der schon mit sechs Jahren als Komponist auftrat und als Wunderkind galt. Mit dem Ziel, aus Ludwig ebenfalls ein Wunderkind zu machen, begann der Vater, ihn im Klavierspiel zu unterrichten. Auch Orgel und Klarinette lernte der junge Beethoven zu spielen. Die strenge Haltung des Vaters behinderte jedoch die Entwicklung des Jungen, der beispielsweise mitten in der Nacht aus dem Bett geholt wurde, um Freunden des Vaters seine Fähigkeiten am Klavier zu demonstrieren. Das hatte zur Folge, dass Beethoven in der Schule oft müde war und an Konzentrationsmangel litt. Mit elf Jahren musste er auf Drängen seines Vaters schon die Schule verlassen.

Auch sonst war Beethovens Kindheit von Problemen heimgesucht. Sein Vater war Alkoholiker, seine Mutter war sehr oft krank und von seinen sechs Geschwistern überlebten nur zwei. Während Beethoven zu seinem Vater ein gespanntes und distanziertes Verhältnis hatte, liebte er seine Mutter sehr. Als er mit vermutlich fünf Jahren an einer Mittelohrentzündung erkrankte, bemerkten die Eltern dies nicht. Die Erkrankung konnte nie richtig verheilen und gilt als eine der Ursachen für die später eintretende Taubheit.
*/
    k++;
 }
}

Name: Anonymous 2007-09-12 7:49 ID:i9LZzsvu

void w(rn,vv,m) int *vv,*rn;??<if(m??!m)*rn++=*vv++,w(rn--,vv--,--m);??>

Name: Anonymous 2007-09-12 7:50 ID:tXaAkcCM

>>29
it works on my computer.

Name: Anonymous 2007-09-12 7:50 ID:EoObRv0X

>>28
not leaving a space in an assignment is seen as  a ridiculous flight of fancy wrt readibility
Of course. Not putting exactly one space around every infix operator is fuck ugly. The microsecond you save is wasted just looking at the screen for the first time, and then you may take an extra second to tell what the fuck a+++++b is.

One space around infix operators should be forced, like the forced indentation of code.

Name: Anonymous 2007-09-12 7:58 ID:Heaven

>>3
a++ ++ +b;


#include <stdio.h>

#define _(_)%:_

int main()

<%char*O0
,_<:~!!_(:)&0xFFu:>={*_()%>;f\
or(O0=_;fgets(O0,sizeof __func__,std\
in);puts(&0<:_:>))while(*O0|*_())*
O0&*_(@)?*O0&=~1^(!!0)[_(!):>:0,O0++;
return printf("\rYelled much?"_(\n));}

Name: Anonymous 2007-09-12 9:02 ID:EoObRv0X

>>34
a++ ++ +b
I know -_-. But if somebody actually writes a+++++b in production code, I'll punch him.

Name: Anonymous 2007-09-12 9:04 ID:FJnvI9i5

>>35
Why, because your code won't compile?

Name: Anonymous 2007-09-12 9:51 ID:Mbi7EEyJ

ONE WORD, THE FORCED space around infix operators THREAD OVER

Name: Anonymous 2007-09-12 11:18 ID:tg2Q+oGx

>>1
it prints out "i am an fuckwad who doesn't know a shit about strncpy()"

Name: Anonymous 2007-09-12 11:22 ID:Heaven

>>38
oh god.. please be a troll.
memcpy() won't work either. ENDIANESS ISSUES DUR DUR

Name: Anonymous 2007-09-12 11:57 ID:ACHJdM9S

>>39 lol ?_?

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