mercredi 23 décembre 2020

how to create range of integer values as vector or array in C++ / C? [duplicate]

I came from world of matlab and python, recently Im learning C/C++ languages . Im trying to find best approach to create range of integers in c/c++ that starts from number 1 till the other determined limit. in matlab I was just doing this: x=1:10, then I get that x is a matrix of 1x10 (an array which equals to x=[1 2 3 4 5 6 7 8 9 10]; x=1:5, then I get that x is a matrix of 1x10 (an array which equals to x=[1 2 3 4 5 ];

so how do I implement that in C++ or C ? I want to create a range -I define its limits- in simple approach and in the best way and store its values as array/list/vector as what I showed above in matlab.

THANKS !

Aucun commentaire:

Enregistrer un commentaire