Skip to content

Instantly share code, notes, and snippets.

@FabiolaRamirez
Created December 6, 2017 01:28
Show Gist options
  • Save FabiolaRamirez/907eada145f82c538bbf49d98b6942f5 to your computer and use it in GitHub Desktop.
Save FabiolaRamirez/907eada145f82c538bbf49d98b6942f5 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <cstring>
using namespace std;
char v1[] = "hello world";
char v2[] = {'h','e','l','l','o',' ','w','o','r','l','d','\0'};
string v3 = "hola pepito";
const char* v4[] = {"hello", "faby"};
//* char v5[] = {'h','e','l','l','o',' ','w','o','r','l','d','\0'};
void array1(){
for (int i=0; i< strlen(v1);i++ ){
cout << v1[i];
}
cout << strlen(v1);
}
void array2(){
for (int i=0; i< strlen(v2);i++ ){
cout << v2[i];
}
cout << strlen(v2)<<endl;
}
void array3(){
cout << v3.length() <<endl;
for (char x : v3) {
cout<< x;
}
}
void array4(){
for (string x : v4) {
cout<< x;
}
}
int main(){
//array1();
//array2();
//array3();
array4();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment