Help with function :)

This is a discussion on Help with function :) within the C++ Programming forums, part of the General Programming Boards category; ok i have a function to return a certain letter for right now. I just want to get the function ...

Help with function :)

ok i have a function to return a certain letter for right now. I just want to get the function to work, later i will have a graphic thing i will print that will correspond to the letter in each of the memory spaces. ok well here it is...

> ok here i realize i made some mistakes in typing the code last time i will show you the copied from the editor
Apparently, this looks the same as last time, so I'm not going to waste any more bandwidth on you.....

More correctly, functions need to be defined before they are called. You could have function f() call function g(),
but g() would need to be defined first, for instance. In a program of reasonable size this quickly becomes a pain so mcpunky wrote a prototype near the top:

Code:

char abcZ(char input[30], unsigned int& count);

The compiler will see this and know exactly what function to call, therefore, he can write the function anywhere in the file.

>> ok so i did declare the function
You did, that conversation was about Dash_Riprock's post.

>> if you look closely both of my sc posts are different.
I looked closely, and I didn't see a difference. Besides, the point was that Salem gave you four things to look at, and you didn't change or respond to any of them.

>> y do i need to declare count in the function outside the array brackets?
You don't need to, mcpunky was apparently showing you one way to make sure count gets updated. Passing it by reference to the function that uses it allows the original variable to be updated.

You shouldn't really be concerned about that now, I would suggest getting your code to compile first. Perhaps start with an empty main and then add things one at a time, compiling as you go so that you can catch all your errors before they pile up into a largely incorrect program.