Difference between revisions of "Optimization Topics/Exercise 06"

From Wiki**3

< Optimization Topics
(Created page with "Considere a seguinte função em C: <c> int main() { int a[10], i = 1; a[0] = 0; while (i < 10) a[i++] = a[i-1] + 2 * i - 1; return 0; } </c> # Identifique os...")
 
 
Line 1: Line 1:
 
Considere a seguinte função em C:
 
Considere a seguinte função em C:
  
<c>
+
<source lang="c">
 
int main() {  
 
int main() {  
 
   int a[10], i = 1;  
 
   int a[10], i = 1;  
Line 9: Line 9:
 
   return 0;  
 
   return 0;  
 
}  
 
}  
</c>
+
</source>
  
 
# Identifique os blocos básicos.  
 
# Identifique os blocos básicos.  
 
# Que optimizações poderiam ser efectuadas?
 
# Que optimizações poderiam ser efectuadas?

Latest revision as of 13:55, 12 February 2019

Considere a seguinte função em C:

int main() { 
  int a[10], i = 1; 
  a[0] = 0; 
  while (i < 10)
    a[i++] = a[i-1] + 2 * i - 1; 
  return 0; 
}
  1. Identifique os blocos básicos.
  2. Que optimizações poderiam ser efectuadas?