To generate a random number in C you can use the following snippet.
Sample C
srand(time(NULL)); int r = rand() % 10; //generates a random number between 0 and 9 printf("%d",r);
All the Code Snippets and Samples you need
To generate a random number in C you can use the following snippet.
srand(time(NULL)); int r = rand() % 10; //generates a random number between 0 and 9 printf("%d",r);
You must be logged in to post a comment.
RT @CodeSnippetsNET: How to generate a random number in #C http://t.co/ff14B6d4sd #programmierung #developer #develop