Back to slide -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'          array-limitations-1-memcpy.c - A solution: Copy the array with memcpy - a low-level alternative.Lecture 1 - slide 20 : 34
Program 10

#include <stdio.h>
#include <string.h>

int main(void) {

  double a[10], b[10];
  int i;

  for(i = 0; i < 10; i++)  /* Initialization */
    a[i] = i;

  memcpy(b, a, sizeof(double)*10);

  for(i = 0; i < 10; i++)
    printf("b[%d] = %f\n", i, b[i]);

  return 0;
}