Reputation: 1
int sk03(char * a) //DELETE! DELEEEEETE!
{ //(Or "Exterminate! EXTERMINAAAAAATE!" if that's your thing.)
int b = sk00(a);
int c = 0;
while(a[b] != '!')
{
a[c] = a[b];
c++;b++;
}
cout << a << "\n";
int your_mom = 0;
return your_mom;
}
int main()
{
char * str = "``sk`sk!";
return sk03(str);
}
This method works fine for when you want to pass the entire string to the function, but how would one pass just the second half of the string to sk03? Would I have to create a complete new array?
Upvotes: 0
Views: 5305
Reputation: 39164
for example you can modify your code to do something like this:
char str[STRING_LENGTH] = "``sk`sk!";
return sk03(&str[3]);
Upvotes: 1
Reputation:
No, you just pass a pointer to the element you want:
char a[100];
sk03( a + 50 ); // call function passing second half of the array
Upvotes: 1