-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sum of Pairs: C solutions by Hardy Jonck
- Loading branch information
Andreas Pauley
committed
May 27, 2010
1 parent
5fafbd7
commit f45740b
Showing
1 changed file
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
// C solution by Hardy Jonck | |||
|
|||
#include <stdio.h> | |||
#include <string.h> | |||
|
|||
|
|||
int main (int argc, const char * argv[]) { | |||
int a[] = {1,2,3,4,5}; | |||
char items = sizeof(a)/sizeof(int); | |||
int b[items]; | |||
int *c=b; | |||
memcpy(&b,&a,items*sizeof(int)); | |||
while(c < &b[items-1]) { *c = *c + *(c+1);printf("%d\n",*c);c++;} | |||
|
|||
return 0; | |||
} |