All pastes #590304 Raw Edit

Stuff

public text v1 · immutable
#590304 ·published 2007-06-26 14:07 UTC
rendered paste body
#include <stdio.h>
#include <stdlib.h>

#define SIZE 10

void X (int a[],int size)
{
	int i;
	int j;
	int sum=0;
	int *p;

	if ((p=(int *)malloc(size*sizeof(int)))==NULL)
	{
		printf("allocation failed\n");
		exit (1);
	}

	for (i=0;i<size;i++)
	{
		sum+=a[i];
		p[i]=sum;
	}

	for (i=0;i<size;i++)
		if (a[i]==a[size-1]-a[i])
			printf ("%d\n",i);
}

int main ()
{
	int a [SIZE]={1,2,3,4,5,1,2,3,4,5};

	X(a,SIZE);

	return 0;
}