aaa How do I program ; - Music techology forums
skin: 1 2 3 4 |  Login | Join Dancetech |

dancetech forums

05-Jul-2024

Info-line:   [synths]    [sampler]    [drumbox]    [effects]    [mixers]     [mics]     [monitors]    [pc-h/ware]    [pc-s/ware]    [plugins]    -    [links]    [tips]

Search forums House rules Live chat Login to access your admin About dancetech forums Forum home Start a new topic

Forums   -   Music techology

Subject: How do I program ;


Viewing all 6 messages  -  View by pages of 10:  1


Original Message 1/6             13-Sep-98  @  12:26 AM   -   How do I program ;

lucius

Posts:

Link?:  No link

File?:  No file



I know this has nothing to do with music, but since I'm here I might
as well ask. Any C or C++ programmers know how a function can
take in 3 values a,b,c and return the values as c,b,a ??
I don't understand this because I thought a function can only return
one value at a time.

Here' the question as asked:
Write a function that will return the numbers in reversed order; i.e.
a,b,c, will now be printed c,b,a, on return from the function.

Anybody understand this.
I know this is way off topic but its better than a stupid comment.
Thanks



[ back to forum ]              [quote]

Message 2/6             13-Sep-98  @  01:19 AM   -   RE: How do I program ;

Will

Posts:

Link?:  No link

File?:  No file



I thought if you wanted to return more than one parameter you had to use a procedure instead of a function. Im probably wrong though. Dont know my ass from my elbow with C.



[ back to forum ]              [quote]

Message 3/6             13-Sep-98  @  01:51 AM   -   RE: How do I program ;

Posts:

Link?:  No link

File?:  No file



Well, in a language like Pascal, you can send variable parameters to functions, or procedures, and then modify them... C only allows value parameters to be sent so they cannot be modified by the function. The way around this is to use pointers (groan) which are basically the memory addresses of the variables you want to change. Buy a book on C for the syntax! You need to stick a * in front of the pointer to access the variable instead of the memory location... Fuck am I bored



[ back to forum ]              [quote]

Message 4/6             13-Sep-98  @  12:15 PM   -   RE: How do I program ;

Geek

Posts:

Link?:  No link

File?:  No file



Christ! Where did the nerds come from?



[ back to forum ]              [quote]

Message 5/6             13-Sep-98  @  02:15 PM   -   RE: How do I program ;

MegaNerd

Posts:

Link?:  No link

File?:  No file



Dunno about c, but in c++ you can also use references to variables so you don't have to hassle around with pointers.

BUT... I really think this kind of conversation doesn't belong here, there are lots of nice newsgroups and sites dedicated to programming.



[ back to forum ]              [quote]

Message 6/6             14-Sep-98  @  11:34 AM   -   RE: How do I program ;

Geek's 'R Us

Posts:

Link?:  No link

File?:  No file



I think it goes a little something like this:

void ReverseOrder(int *a,int *b,int *c)
{
// b is not really needed now is it!
int dummy;
dummy=*c;
*c=*a;
*a=dummy;
}

now suppose you have int variables d,e,f
you would call the procedure like:

.. bla
int d=3;
int e=5;
int f=7;

ReverseOrder(&d,&e,&f);

//d=7, e=5, f=3



[ back to forum ]              [quote]

Viewing all 6 messages  -  View by pages of 10:  1

There are 6 total messages for this topic





Reply to Thread

You need to register/login to use the forum.

Click here  to Signup or Login !

[you'll be brought right back to this point after signing up]



Back to Forum





Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)