Hello all. Anywho ive been studying c now for a few weeks, and up until now it has not been too steep of a learning curve for me but that has changed recently. My problem is basically that i need to create an array with 50 random integers using srand() . Now i've determined that the easiest way to do this is to use a for loop. However i'm unsure as to how i would set up this for loop so that it does all 50 integers within the array.
Any help would be greatly appreciated.
Thanks!
patsfan4878 0 Newbie Poster
Recommended Answers
Jump to Post/* * Giveme50.c * Show how to assign random integer into array. */ #include <stdio.h> #include <stdlib.h> #include <time.h> int main( void ) { int fifty[50]; int i; srand( (unsigned ) time( NULL ) ); for( i = 0 ; i < 50; i++ ) { fifty[i] …
All 3 Replies
Aia 1,977 Nearly a Posting Maven
Rashakil Fol commented: I'm Rashakil Fol and I disapprove of this message. -2
Salem commented: Balance++ +9
sillyboy 43 Practically a Master Poster
Aia 1,977 Nearly a Posting Maven
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.