trying to print the number of certain letter in a string but code gives general exception
what to do, what to do...
Code:
#include<stdio.h>
#include<string.h>
int main(void)
{
char c,p[30]="breaka is one bad motha........er";
int pos,i=0,j,array[30];
printf("wich letter: ");
c = getchar();
scanf("%*[^\n]%*c");
while((pos=(strchr(p,c)-p))>=0){
array[i]=pos;
i++;
}
printf("number: %d\npositions: ");
for(j=0; j<i; j++)
printf("%d ",array[i]);
return 0;
}
this message board is censuring the f word in code, what a laugh!!!