mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
Update c.html.markdown
This commit is contained in:
parent
abd7444f9e
commit
9796759379
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user