No... here is my code now:
Code:
1 : #include <string.h>
2 : #include <stdio.h>
3 :
4 : extern int Replacing(char *string, char replacing, char replacement)
5 : {
6 :
7 : char * string_ptr;
8 :
9 : while((string_ptr=strpbrk(string,replacing))!=NULL)
10 :
11 : *string_ptr=replacement;
12 :
13 : return * string_ptr;
14 : }
15 :
16 : int main() {
17 :
18 : char string[255] = "This is testing...";
19 :
20 : char * buffer;
21 :
22 : printf("Before:\n%s", string);
23 :
24 : *buffer = Replacing(string, ' ', '-');
25 : printf("\nAfter:\n");
26 : printf("%c", *buffer);
27 :
28 : getch();
29 :
30 : return 0;
31 :
32 : }
The error im getting when complying is:
Code:
in function 'Replacing':
[Warning] passing arg 2 of `strpbrk' makes pointer from integer without a cast
If i make the 2nd argument prototype have a * in it, it complys but doesnt work...
P.S. The line numbering was done by my other C examples ive made so far Seems like it works?