+ 1
How can I make the code have a for for N numbers and not for 6
2 Réponses
+ 1
I don't really understand the language, but I think you can try to use a loop, a for-loop will do the job just fine 👍
Assuming we have a variable <N>, with value of 6 (for example);
// for input
for(int i = 0, v; i < N; i++)
{
scanf("%d", &v); // read value
apilar(&original, v); // push
}
// for copying from original -> aux
for(int i = 0; i < N; i++)
{
apilar(&aux,desapilar(&original));
}
// for printing elements
for(int i = 0; i < N; i++)
{
printf("%i ",desapilar(&aux));
}
+ 1
Hi