Thread: Calculating the length of a string

  1. #31
    Registered User
    Join Date
    Feb 2008
    Posts
    93
    Quote Originally Posted by robwhit View Post
    Okay...

    Functions need arguments.

    Arguments are values.

    Values have types.

    You specify those types when you define the function.

    You pass a value of that type to the function when you call the function.

    If you pass a value of a different type to the function, the code in the function might not work right.

    Understand?

    Code:
    argument = values
    
    values have types int, float, long, double, unsigned intenger, etc
    
    Specify those value types when you define the function.
    
    function prototype
    
    return name ( take in )
    {
    
    }
    
    
    
    You pass a value of that type to the function when you call the function?
    
    What I take in or what I return in the function prototype?

  2. #32
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    This thread is quickly going nowhere...

    Anyways, here's a simple outline of functions:

    output = Function( input );

    Note: it is possible to pass a pointer to a function and get some output in that pointer parameter, so you to be more accurate, this is also possible:

    output = Function( input and/or output );

    If a parameter is const then it obviously can only be input since it is read-only as far as that Function is concerned.
    If the parameter is not a pointer, it also is only input because there is no way for the Function to modify the value outside of the function because it is a copy of the data, not the same data.

    Here is a site with tutorials for things such as Functions (although this is C++, not C, but most of it applies to both languages): http://www.cplusplus.com/doc/tutorial/functions.html

  3. #33
    Registered User slingerland3g's Avatar
    Join Date
    Jan 2008
    Location
    Seattle
    Posts
    603
    BSmith4740,

    When you post on these forums and not understanding the fundamentals, you will get a hard taste of reality.


    So what's the best way to learn C? You can only read the book so many times. You can't talk to the book. You can't ask questions to the book. However, I do appreciate the help.

    I would prefer you read the books below and code the exercises given. The books below are what I use for reference and as well as these forums.

    "The C book"
    http://www.amazon.com/Programming-La...5024293&sr=8-3


    "A book on C"
    http://www.amazon.com/Book-C-Program...5024354&sr=1-1


    The best way to learn any language is to code and code and code. You must practice any sport to be come efficient to become good at it, this goes with learning any programming language as well.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compile Error that i dont understand
    By bobthebullet990 in forum C++ Programming
    Replies: 5
    Last Post: 05-05-2006, 09:19 AM
  2. C++ FTP class won't work
    By lord mazdak in forum C++ Programming
    Replies: 8
    Last Post: 12-18-2005, 07:57 AM
  3. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 10:33 PM
  4. Weird modification to string length
    By ChwanRen in forum C Programming
    Replies: 0
    Last Post: 08-17-2003, 10:45 AM
  5. string handling
    By lessrain in forum C Programming
    Replies: 3
    Last Post: 04-24-2002, 07:36 PM