jeudi 3 décembre 2020

how to use printf when printing a value from vector

I wanted to print the value of string type in a vector using printf but it crashes when i run the program. Please help.

vector<string> vec{"zero","one","two","three","four","five","six","seven","eight","nine"};
printf("%s\n",vec[1]);

Aucun commentaire:

Enregistrer un commentaire