Initial commit
This commit is contained in:
17
kapitel11/call-by-ref.c
Normal file
17
kapitel11/call-by-ref.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void inc(int *tal);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int x = 5;
|
||||
printf("x är nu: %d\n", x);
|
||||
inc(&x);
|
||||
printf("x är nu: %d\n", x);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void inc(int *tal)
|
||||
{
|
||||
*tal = *tal + 3;
|
||||
}
|
Reference in New Issue
Block a user