int i 10 int a 10301248 int s 0 for i 0 i 0 s ai conver
int i = 10;
int a[] = {10,-30,-12,4,8};
int s = 0;
for (i = 0; i<5; i++)
if (a[i] > 0)
s += a[i];
convert c language to assembly
Solution
I have complited the above source to generate assembly code using GNU C compiler. I have added few libraries in the code for compilation. I have copied the code in file name : test.c. And compiled using the command :
gcc -std=c99 -c -Wa,-ald -g test.c
The generated assembly code is:
![int i = 10; int a[] = {10,-30,-12,4,8}; int s = 0; for (i = 0; i<5; i++) if (a[i] > 0) s += a[i]; convert c language to assemblySolutionI have complited t int i = 10; int a[] = {10,-30,-12,4,8}; int s = 0; for (i = 0; i<5; i++) if (a[i] > 0) s += a[i]; convert c language to assemblySolutionI have complited t](/WebImages/4/int-i-10-int-a-10301248-int-s-0-for-i-0-i-0-s-ai-conver-977515-1761501542-0.webp)