L
Logan
/* Return B from ABC
I get segementation error when I execute this. Please help.
*/
char* getSubstring(char* larger, int a, int b) {
char* smaller;
int i;
for(i=0; i<b; i++) {
smaller=larger[a+i];
}
return smaller;
}
int main() {
char* l="abcabcabc";
printf("%s", getSubstring(l, 3, 3));
}
I get segementation error when I execute this. Please help.
*/
char* getSubstring(char* larger, int a, int b) {
char* smaller;
int i;
for(i=0; i<b; i++) {
smaller=larger[a+i];
}
return smaller;
}
int main() {
char* l="abcabcabc";
printf("%s", getSubstring(l, 3, 3));
}