View difference between Paste ID: VxcuQyqD and VakiXpgq
SHOW: | | - or go back to the newest paste.
1
#include<stdio.h>
2-
//example of array size determination:  sizeof(list) will NOT work by itself
2+
//prep to copy two arrays of integers into one. (form a union)
3
int main()
4
{
5
  int i=0;
6-
  char name[] = "cool";
6+
  int a[] = {1,2,3,4,5,6,7,8};
7-
  int list[] = {1,2,3,4,5,6,7,8};
7+
  int b[] = {14,15,16};
8
9-
  printf("The size of the array is %d \n", sizeof(list)/sizeof(int)  ); 
9+
  int M = sizof(a) / sizeof(int);
10-
  printf("The size of the array is %d", sizeof(name)/sizeof(char)  );
10+
  int N = sizof(b) / sizeof(int);
11
12
  int* c = malloc( (M+N)* sizeof(int) );  
13
  
14
  return 0;
15
}