can any one please tell me am i done my question right?
my question is to store store 1035 to 1265 random in a character array and display the array.
and im not sure whats this srand is doing?

int main(){
char b[30];
for(int i=0;i<30;i++)   {
for(int i=0;i<10;i++)   {
return 0;}

srand() is ued to seed the random number generator. If you call srand() with the same number every time your program is run rand() will generate the same sequence of random numbers, which is the default if the program never calls srand(). To get rand() to generate a different set of random numbers each time the program is run you need to call srand() with a different seed number. The easiest way to do that is to call time() function from time.h, like this: srand( time(0) ); you might have to typecast the return value of time() to unsigned int if your compiler complains about it.

What srand() does not do: that function does NOT set the lower value of the numbers returned by rand(), as you are implying in your program. See the examples here to find out the correct way to do that.

Ancient Dragon@ Ok thanks alot, im i done my question right?

I don't know if you are done or not -- that's up to you to determine.

my question is to store 1035 to 1265 random in a character array and display the array.

Yes, I know what you question was -- but you asked if it was done. How am I supposed to know if you are finished with it or not?

by checking the code,

I already told you your code is wrong and how to fix it. You have not posted your corrected code. And you can easily check it yourself by compiling and running it. When you run that program it will tell you whether it is right or wrong.

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.