Skip to content

Instantly share code, notes, and snippets.

@vquaiato
Created May 22, 2020 04:36
Show Gist options
  • Save vquaiato/275d2ac9c996421348be438ae1c9ecd6 to your computer and use it in GitHub Desktop.
Save vquaiato/275d2ac9c996421348be438ae1c9ecd6 to your computer and use it in GitHub Desktop.
passing arrays to functions cpp
#include <iostream>
#include <vector>
#include <string>
using namespace std;
void foo(string meu_array[], int size)
{
for(int i = 0; i < size; i++){
cout << " " << meu_array[i];
}
}
int main()
{
string msg[3] = {"Hello", "Array", "World!"};
foo(msg, size(msg));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment