I want do delete all occurrences of a char in a given string, but I really don't see my error in the code. So I hoped someone could help me.
Here is how I did it:
I get segmentation or bus errors..Code:char *input = "example_string"; int len = strlen(input); char *new_line[len]; char bad = 'e'; //the one to delete int i; int j = 0; for (i =0; i < len;i++) { char next = input[i]; if (next != bad) { new_line[j] = next; //here I get a warning : incompatible integer to pointer conversion assigning to char* from char. j++; } }
And I also don#t understand the warning I get. new_line is an array of chars, and I am trying to assign to it a certain char.