Welcome to the forum. Next time you post, make sure you post your try in code tags, like these [code]/* your code*/[/code].
Because it's your first post, I am going to give a sample code, in order to get ideas. Let's say I have an array, that I wanted to be filled only with zeroes and ones, by the user, in whatever cell the user wants too.
I could do that with this code
Code:
#include <stdio.h>
int main(void)
{
int array[5];
/* i will go through all the cells of the array */
int i;
for( i = 0 ; i < 5 ; i++)
{
do{
/* Print message and read element,
* until it gets the value 1 or 0 */
printf("Input %i-th element\n", i);
scanf("%d", &array[i]);
}while(array[i] != 1 && array[i] != 0);
}
printf("The array is:\n");
for( i = 0 ; i < 5 ; i++)
{
printf("array[%d] = %d\n", i, array[i]);
}
return 0;
}