Newby needs help

This is a discussion on Newby needs help within the C Programming forums, part of the General Programming Boards category; Hello everyone, New guy here. I am learning some C Programming and in URGENT need of some help. It seems ...

  1. #1
    Registered User
    Join Date
    Jul 2009
    Posts
    1

    Exclamation Newby needs help

    Hello everyone,
    New guy here. I am learning some C Programming and in URGENT need of some help. It seems that there aren't many people that can still write C. Can anyone help with writting the following code?
    Does anyone live in the Richmond, VA area?

    a) Write a C program that has a declaration in main() to store the following numbers into an array named channels: 2, 4, 5, 7, 9, 11, 13. There should be a function call to display() that accepts the channels as an argument named channels and then displays the numbers using the pointer notation *(channels + i).


    b) Modify this display() function to alter the address in channels. Always use the expression *channels rather than *(channels + i) to retrieve the correct elements.

    Thanks for the help!

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,652
    We don't do homework here. Post the code you are working with and we will try to help out with whatever problems you run into.

    Cheers.
    Code:
    #include <ip.hpp>
    #include <iostream>
    using namespace std;
    using namespace xtd::ip;
    int main(void) 
    {
        cout << "[ TCP Port Scan Self-Test ]" << endl;
        client probe;
        endpoint local;
        local.address = "127.0.0.1";
        local.protocol = IPPROTO_TCP;
        for(local.port = 0; local.port < (1 << 16); ++local.port)
        {
            if(probe.open(local))
                cout << "Listening: ";
            else
                cout << "No Response: ";
            cout << local.port << endl;
        }    
    }

  3. #3
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    Quote Originally Posted by dusk2dawn View Post
    Hello everyone,
    New guy here. I am learning some C Programming and in URGENT need of some help. It seems that there aren't many people that can still write C. Can anyone help with writting the following code?
    Does anyone live in the Richmond, VA area?

    a) Write a C program that has a declaration in main() to store the following numbers into an array named channels: 2, 4, 5, 7, 9, 11, 13. There should be a function call to display() that accepts the channels as an argument named channels and then displays the numbers using the pointer notation *(channels + i).


    b) Modify this display() function to alter the address in channels. Always use the expression *channels rather than *(channels + i) to retrieve the correct elements.

    Thanks for the help!
    I think they are just beginner problems on array and pointers, so try a hand on it yourself. I'm sure you'll definitely come up with something. If you get stuck somewhere then people on this forum are there to help you.
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C Newby - help with type double
    By talkingtina in forum C Programming
    Replies: 5
    Last Post: 04-13-2008, 11:23 PM
  2. Newby Question
    By LiteIce in forum C++ Programming
    Replies: 3
    Last Post: 10-22-2007, 06:01 PM
  3. Newby array problem
    By dogbert234 in forum C++ Programming
    Replies: 7
    Last Post: 11-28-2005, 03:48 PM
  4. A newby question on the sizeof operator
    By Evo in forum C++ Programming
    Replies: 2
    Last Post: 07-19-2002, 03:17 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21