Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Both x and y are required to pass information to and from the function but that's 2
- variables not just one (like you do when you write a program w/ no
- functions at all - one that is entriely in main w/ just basic routines like printf
- and scanf). This is a difference and a big one. What is going on here between these
- 'two' variables? They don't seem to be accomplishing anything more than the single
- variable "x" in what it does between lines 15 and 16 - why two of them to accomplish
- the same thing then? (just passing data).*/
- #include <stdio.h>
- int main (void)
- {
- int x;
- printf("Enter a value: \n");
- scanf("%d", &x);
- printf("%d\n", func());
- }
- int func(int y) {
- int total;
- total = x*2;
- return total;
- }
Add Comment
Please, Sign In to add comment