I am a new programming student and am having a bit of diffulty on an assignment. I do not want someone to finish writing my code, just some advise on what to do or how to accomplish a task. Our assignment was to generate 'x' amount of random numbers and then sort them into rows and columns as determined by the user. I know this is basic array manipulation, I can generate numbers and ask the user how many rows and columns, but I can not put those numbers into an array, every time I use a statement like "inary[100] = rand()" and test it with a printf function later it outputs a different number than what was generated. I have listed a small piece of code , if you could help me in any way I would be very thankful.
Code:
[
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
void main(void);
void main(void)
{
int i, no, rowno, colno;
int inary[100] = {rand()}, outary[100][100] = {rand()};
srand(0);
printf ("How many random numbers to be generated?");
scanf ("%d", &no);
{
for (i=1; i<=no; i++)
printf("%d\n", rand());
}
printf ("How many rows?");
scanf ("%d", &rowno);
printf ("How many columns?");
scanf ("%d", &colno);
getch();
}
]