Astrocloud
Technical User
- May 29, 2007
- 13
Hi, I am revisiting C programming after being away from it for about 10 years. I have since programmed in other languages but I forget the exact issues with C. For a refresher -I thought I would implement the following proc. After I compile it with gcc -it returns a wild number. How can I do this differently and why is it returning this weird number? Here is my rather simple program:
____________________
#include <stdio.h>
int calcKey(long Speed, long Est, long Cost, long Key) {
Key = Speed * Est + Speed * Cost + Est;
return;
}
int main() {
long heat;
calcKey(10,3,4, heat);
printf("result is %d \n", heat);
};
Thanks!
____________________
#include <stdio.h>
int calcKey(long Speed, long Est, long Cost, long Key) {
Key = Speed * Est + Speed * Cost + Est;
return;
}
int main() {
long heat;
calcKey(10,3,4, heat);
printf("result is %d \n", heat);
};
Thanks!