How to print array in C+++ | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
1st Sep 2017, 7:42 AM
Sushmit Mishra
Sushmit Mishra - avatar
2 Respuestas
+ 13
Unfortunately, loops and user input won't work well together, for Code Playground.
1st Sep 2017, 7:55 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
#include <algorithm> ... for_each(array.begin(), array.end(), [](int i){ //int is here the type of the array's elements cout<<i<<' '; }); cout<<endl; PS : creating a static array of size defined at runtime (not constant) is forbidden, you should do : int * array = new int[arraySize]; ... delete array; i <= arraySize will overflow, change it for <
1st Sep 2017, 7:54 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar