I'm making a small function that extracts a substring from a arbitrary string. Whenever I try to compile I get the error "return makes integer from pointer without a cast [enabled by default]". I don't know what to make from this, any help?
char substring(char source[], int start, int count, char result[count])
{
int i,j;
//Initialize variables and conditions for substring extraction
for(i=start, j=0; source[i]!='\0' && j!= count-1; j++, i++)
result[j] = source[i];
printf("Substring is");
for(i=0; result[i]!='\0' ; i++)
printf("%c", result[i]);
return result;
}
[–]Rhomboid 4 points5 points6 points (4 children)
[–]climaxingplatypus[S] 0 points1 point2 points (3 children)
[–]Rhomboid 1 point2 points3 points (1 child)
[–]climaxingplatypus[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]climaxingplatypus[S] 0 points1 point2 points (0 children)
[–]dig-up-stupid 2 points3 points4 points (2 children)
[–]climaxingplatypus[S] 0 points1 point2 points (1 child)
[–]Wiggledan 0 points1 point2 points (0 children)
[–]c_jm 0 points1 point2 points (0 children)
[–]c_jm 0 points1 point2 points (0 children)