Created
June 4, 2019 02:51
-
-
Save kaityo256/d5b5f3e7c309ced9a0705d6819f8a59b to your computer and use it in GitHub Desktop.
Constant folding with array (local variable)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstdio> | |
| int func(int b[4]) { | |
| int a[] = {1, 2, 3, 4}; | |
| int sum = 0; | |
| for (int i = 0; i < 4; i++) { | |
| sum += a[i] * b[i]; | |
| } | |
| return sum; | |
| } | |
| int main() { | |
| int b[] = {5, 6, 7, 8}; | |
| printf("%d\n", func(b)); | |
| } |
Author
kaityo256
commented
Jun 4, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment