Can any body plz give me code to generate 4 digit random number which should not be repeated if appear once until all 9998 combinations. Code should run in KEIL for ARM. I wrote one with 'randomize ()' and random function which is giving an error in KEIL.
Plz guide.
I came to know about one logic. In my project i am using mobile no. Its 10 digit no. Now if i divide this no by some 7 digit no then i will get 4 digit no that will be the random no. Now issue is the function which is sending data to GSM is taking unsigned char data then how to declare the mobile no and other 7 digit no which will divide the 10 digit mobile no. Means what should be the datatype? Do i have to take an array for both the numbers ? can i divide numbers in an array ? if not then how to divide them?
This means you are using some GSM modem. Once you get all the numbers required you should convert them to unsigned char array and you will be using an itoa function to covert them to ASCII.
Sorry to trouble you again, But can you plz tell me how to convert whole 4 digit no in unsigned char array? Do i have to separate the digits and store them in an array? Or any other method i have to employ?
its good to hear that you are thinking. Once you got a number whether it is signed or unsigned use sprintf function to convert that to an array. An example is given here