diff options
author | himanshu81494 <himanshu81494@gmail.com> | 2015-10-08 14:44:10 +0530 |
---|---|---|
committer | himanshu81494 <himanshu81494@gmail.com> | 2015-10-08 14:44:10 +0530 |
commit | 9796759379d77a848ef84f8c1019672b87b90822 (patch) | |
tree | 0d67bc07e66dbae314fb8f2d964e446b1acad6ca | |
parent | abd7444f9e5343f597b561a69297122142881fc8 (diff) |
Update c.html.markdown
-rw-r--r-- | c.html.markdown | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/c.html.markdown b/c.html.markdown index db2ac930..b99cfe84 100644 --- a/c.html.markdown +++ b/c.html.markdown @@ -472,7 +472,22 @@ char c[] = "This is a test."; str_reverse(c); printf("%s\n", c); // => ".tset a si sihT" */ - +//as we can return return only one variable +//to change values of more than one variables we use call by reference +void swapTwoNumbers(int *a, int *b) +{ +int temp = *a; +*a = *b; +*b = temp; +} +/* +int first = 10; +int second = 20; +printf("first: %d\nsecond: %d\n", first, second); +swapTwoNumbers(&first, &second); +printf("first: %d\nsecond: %d\n", first, second); +// values will be swapped +*/ // if referring to external variables outside function, must use extern keyword. int i = 0; void testFunc() { |