I want to pass a char[] as reference or pointer to a function which modifies the array.
void GetName(char* name[],int* size)
{
char arr[5] = { 'a','b','c','d' };
for (int i = 0; i < 4; i++)
*name[i] = arr[i];
*size = 4;
}
int main()
{
char array[10];
int size=NULL
GetName(&array,&size);
cout<<"Length of Name:"<<size<<endl;
cout<<"Name:"
for(int i=0;i<size;i++)
{cout<<array[i];}
return 0;
}
The above code is not correct. How do I make this work. Edit:
This code modifies the argument passed to the function