Parameter transfer to functions via pointer in C
Hi, i got a code from a book of my university and it does not work. Error message: warning: 'swap' defined but not used [-Wunused-function] void swap(int *a, int *b) ^~~~ ..\Playground\~1\AppData\Local\Temp\cc2dRKGB.o:source.c:(.text+0x46): undefined reference to `swap' collect2.exe: error: ld returned 1 exit status Even if i try other online C Compilers the message is the same. (I simply want to change two Variables) Code: #include <stdio.h> void swap(int *a, int *b); int main() { int zahl1, zahl2; zahl1 = 10; zahl2 = 20; printf("Startvalue: Zahl1: %i, Zahl2: %i", zahl1, zahl2); swap(&zahl1, &zahl2); printf("Finalvalue: Zahl1: %i, Zahl2: %i", zahl1, zahl2); return 0; void swap(int *a, int *b) { int vhilf; vhilf = *a; *a = *b; *b = vhilf; } }