how to create a definition ...

I am trying to create the defintion of a function in file foo2.c, not directly but by an invocation of another file makeFoo2.c
Function foo2() has to prompt for who do you want to say hello to and reads the string from stdin and returns that string
Please help:::

Comments

  • : I am trying to create the defintion of a function in file foo2.c, not directly but by an invocation of another file makeFoo2.c
    : Function foo2() has to prompt for who do you want to say hello to and reads the string from stdin and returns that string
    : Please help:::
    :

    Right okay, so what are you asking exactly?

    If you want to create definitions and put them in other files then you should be using a .h extension on your files - whether it's C or C++.

    If the function returns a string then it will be of return type string ie:

    [code]string foo2();[/code]

    remember to include the string.h header file, so that you can use the string class otherwise you will not be able to use the above declaration.

    Another option would be to return an array of chars, but this may be a little more messy, especially in a C++ program where you've already got the string class to handle everything for you.

    Hope this helps,

    ITA
    "Let us smite the evil slime eating hordes who may befall us on our quest to be the ultimate programmers of the known universe!"

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion