Pass array values directly on function call?


i want to ask if something like this is possible

void my_function(string array[]){


//Call the function and pass datas directly


Not possible.
  1. Not possible. Individual values are not an array.
  2. Arrays are passed by reference, not by value.
  3. You can only use the type array[]={…}; form with constants.
void my_function(string& array[]){


string T[3]; T[0]="text1"; T[1]="text2"; T[2]="text3";

Well you can pass a single value of an array like:

void my_function(string str ) {

//Call the function and pass single data directly
my_function( arr[2] );