H includestdlibh includetimeh definesize20 intmain

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: rse order...\n"); j=SIZE‐1; for(i=0; i<SIZE; i++) { arr2[i] = arr1[j]; j‐‐; printf("%d ", arr2[i]); } printf("\n\n\n"); system("PAUSE"); return 0; } Problem 2: #include<stdio.h> #include<stdlib.h> #include<time.h> #define SIZE 20 int main(){ srand(time(0)); int largeArray[SIZE]; int smallArray1[SIZE/2],smallArray2[SIZE/2]; int i; for(i=0;i<SIZE;i++){ largeArray[i]=rand()%100; } for(i=0;i<SIZE/2;i++){ smallArray1[i]=largeArray[i]; } for(i=SIZE/2;i<SIZE;i++){ smallArray2[i‐SIZE/2]=largeArray[i]; } printf("Printing the large array\n"); for(i=0;i<SIZE;i++){ printf("%d ",largeArray[i]); } printf("\n"); printf("Printing the first half\n"); for(i=0;i<SIZE/2;i++){ printf("%d ",smallArray1[i]); } printf("\n"); printf("...
View Full Document

This document was uploaded on 01/15/2014.

Ask a homework question - tutors are online