Blame view

lab2/printArray.c 503 Bytes
e1249c637   kmazouzi   add debug lab2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  
  #include <stdio.h>
  
  // print an array of integers, all on one line.
  void printIntArray(int *a, int n)
  {
  
   int i; // i is a "local variable" inside printIntArray
  
    // A loop that prints every value in the array
    for (i=0; 1<n; i++)   
        a[i]=a[i]*2;
        // printf("a[%d]=%d ",i,a[i]);
  
    printf("
  "); // Then we end with a new line"
  }
  
  // A main to demonstrate the printIntArray function...
  
  int main()
  {
  
    int b[] = {22,13,78,9,42};
    printIntArray(b, 5);
  
    return 0; // indicates success
  }