Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-12-2004, 01:05 PM   #1
Registered: Feb 2004
Posts: 155

Rep: Reputation: 30
Last assignment and I am lost

I need same help (again)

I am suppose to use pass-by-reference from a sub-rotine to the main() but I am really lost

 *  *         Asgn10.c                              *
 *   *         Written by :        *
 *    *************************************************/
#include <stdio.h>

void name();
int input();

/* define arrays */

int keeper[5];

 *                  main rotine
        int keeper[5];

        printf("%d\n", &keeper[5]);


 *              name rotine                     *
 void name()
        printf("%s\n\n", PROGRAMMER);

 *              Input rotine                     *
int input()
         int f;
         for ( f = 0; f < 5; f++)
             printf("Enter integer number %d : ", f+1);
             scanf("%d", &keeper[f]);

        return &keeper[];

The idea is to pass the address of the data in the array to the main rotine but I am having a hard time on this one....please help...


Last edited by Veteq; 08-12-2004 at 01:59 PM.
Old 08-12-2004, 01:17 PM   #2
Senior Member
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
before you try fiddling with passing arguments by reference i suggest you learn more basic stuff like syntax a bit better because "int input();" in main makes no sense, and "printf("%d\n", &keeper[5]);" certanly isnt what you want to do.

whens the assignment due?? and have you been to see your tutor?

<edit>if this sounds harsh im sorry but from the current state of the program i see no way to guide you to the answer and i dont want someone to just blurt out the answer as that wont help you.</edit>

Last edited by kev82; 08-12-2004 at 01:19 PM.
Old 08-12-2004, 02:55 PM   #3
Registered: Feb 2004
Posts: 155

Original Poster
Rep: Reputation: 30
I got it all working, thank you. Once I understood the concept, it was easy.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
automatic Ip assignment rupeshdwivedi Linux - Networking 1 08-31-2005 05:20 PM
Domain Assignment dramous Linux - Newbie 1 09-27-2004 03:36 AM
IP address assignment n3tw0rk Linux - Networking 1 01-05-2004 01:23 AM
need help with class assignment tenraek Linux - General 4 04-03-2003 01:31 AM
IP assignment - permanent? dalraidia Linux - Networking 1 12-13-2002 11:55 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:06 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration