Skip to content

Commit 34c6a96

Browse files
committed
Array
1 parent e95b249 commit 34c6a96

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

01_SimpleCApp/SimpleCApp.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,17 @@ int scan_int(int32_t* x)
4242

4343
void execute_print(int32_t x, int32_t count)
4444
{
45+
int32_t y_value[255]; // 0 - 254
46+
if (count > 255) count = 255;
47+
48+
for (int32_t i = 1; i <= count; i++)
49+
{
50+
y_value[i - 1] = f(i * x);
51+
}
52+
4553
for (int32_t i = 1; i <= count; i++)
4654
{
47-
int32_t y = f(i * x);
48-
print_fx(i * x, y);
55+
print_fx(i * x, y_value[i - 1]);
4956
}
5057
}
5158

0 commit comments

Comments
 (0)