Pass, edit and return variable in C
Posted
by
Supertecnoboff
on Stack Overflow
See other posts from Stack Overflow
or by Supertecnoboff
Published on 2012-12-10T15:56:01Z
Indexed on
2012/12/10
17:03 UTC
Read the original article
Hit count: 126
I am new to C programming and recently I have been playing around with functions in C programming. But I have a simple problem:
Basically I want to pass an integer to a function, have the function edit it and then pass back the integer to the main function. I am working on this but it isn't working.....
Here is my code:
int update_SEG_values(int DIGIT_1, int DIGIT_2) {
// How many tens in the "TEMP_COUNT".
DIGIT_2 = ((TEMP_COUNT) / 10);
// How much is left for us to display.
TEMP_COUNT = TEMP_COUNT - ((DIGIT_2) * 10);
// How many ones.
DIGIT_1 = ((TEMP_COUNT) / 1);
return(DIGIT_1, DIGIT_2);
}
What am I doing wrong here?
© Stack Overflow or respective owner