I hoipe I can ask another question here. I want to make a function witch changes the values of two strings.
Code:
#include<stdio.h>
void switchem(char *p1, char *p2);
int main()
{
char niz1[]="Niz1";
char niz2[]="Niz2";
printf(" Niz1: %s Niz2: %s\n", niz1,niz2);
switchem(&niz1,&niz2);
printf(" Niz1: %s Niz2: %s\n", niz1,niz2);
return 0;
}
void switchem(char *p1, char *p2){
char *temp;
temp=p2;
p2=p1;
p1=temp;
}
I want the niz1="Niz2" and niz2="Niz1". I want to do this with pointers. But I get . I get an error saying: passing arg1 and arg2 to the method switchem from incompatible pointer type.