repo.or.cz
/
C-Programming-Examples.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Added stack address randomization example.
[C-Programming-Examples.git]
/
cbd_rand.c
blob
6dde0899133a002aa56b4f465c600f3bf8e7f130
1
#include <stdio.h>
2
#include <stdlib.h>
3
4
int
main
(
void
)
5
{
6
int
i
,
n
,
col
;
7
8
printf
(
"
\n
%s
\n
%s"
,
9
"Some randomly distributed integers. "
,
10
"How many to print? "
);
11
scanf
(
"%d"
, &
n
);
12
printf
(
"How many columns? "
);
13
scanf
(
"%d"
, &
col
);
14
15
for
(
i
=
0
;
i
<
n
; ++
i
)
16
{
17
if
(
i
%
col
==
0
) {
printf
(
"
\n
"
); }
18
printf
(
"%d"
,
rand
()%
10
);
19
}
20
printf
(
"
\n
"
);
21
22
return
0
;
23
}