I just wanna know how i can save the value and the index for my array “cadenaNumeros” in a integer, if the user entry is something like this : 123456789 or 48934013 or 183853025… etc.
I was thinking do it with a FOR, but my code didn´t work.
For example: if we have this array “123456789” the value will be 2 and index = 1 and this numbers save it in a integer.
I’m programming in ANSI C.
#include <stdio.h>
#include <stdlib.h>
void main()
{
int a = 0, i = 0, indice, numero[20], vuelta, quedan, x;
int cadenaNumeros[20000];
int num, num2;
printf("\n\nEscribe el numero de palancas: ");
scanf("%d", &num2);
printf("\n\nEscriba el numero de la palanca roja: ");
scanf("%d", &num);
printf("\n\nIntroduzca una cadena de numeros: ");
scanf("%d", &cadenaNumeros);
for(i = 0; cadenaNumeros[i] < num2; i++); {
cadenaNumeros[0] == numero[x];
printf("%d", numero[x]);
}
system("PAUSE");
return 0;
}
1 Answer