Passing & Returning Strings from Functions

This is a discussion on Passing & Returning Strings from Functions within the C Programming forums, part of the General Programming Boards category; Hi, I am new to C coding, but familar with a number of other languages. Can anybody, please, provide a ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    6

    Question Passing & Returning Strings from Functions



    Hi, I am new to C coding, but familar with a number of other languages. Can anybody, please, provide a simple, clear example of how to:

    1. assign a string in the main() program
    2. pass the string to a function sub()
    3. print the string that has been passed to sub()
    4. return the string to main()
    5. print the returned string in main().

    I have become quite confused about pointers, but I think I need to use them to reference the contents of my array.

    If anybody can help I would be very grateful - Thx

  2. #2
    Registered User
    Join Date
    Jan 2002
    Posts
    6

    Thumbs up

    Ah-ha, the mist is clearing! Thank you very much.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Passing arrays of pointers into functions
    By ashley in forum C Programming
    Replies: 5
    Last Post: 01-13-2007, 05:48 PM
  2. functions and passing data
    By redmondtab in forum C Programming
    Replies: 41
    Last Post: 09-21-2006, 12:04 PM
  3. Passing arguments between functions
    By Wiretron in forum C Programming
    Replies: 4
    Last Post: 05-17-2006, 04:59 PM
  4. Replies: 7
    Last Post: 04-19-2006, 11:17 AM
  5. Replies: 1
    Last Post: 01-20-2002, 10:50 AM

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