#include "functions.h"

int somma(int x, int y) {
	printf("somma: %d+%d=%d\n", x, y, x+y);
	return x+y;
}


int asomma(int array[], int lunghezza){
	int risultato=0;
	int i;
	for(i=0; i<lunghezza; i++)
		risultato+=array[i];
	return risultato;
}


int strlen1(char *s){
	int count;
	for(count=0; s[count]!='\0'; count++);
	return count;
}

void swap(char *a, char *b){
	char tmp=*b;
	*b=*a;
	*a=tmp;
}

void reverse(char *s){
	int l=strlen(s);
	int i;
	char tmp;

	for(i=l-1; i>=l/2; i--){
	/*
		tmp=s[i]; 
		s[i]=s[l-1-i];
		s[l-1-i]=tmp;
	*/
		swap(&s[i],&s[l-1-i]);
	}
	
	return;
}
