Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #define tam 3
- int somaum (int *, int);
- int main (void)
- {
- int vet[tam] = {1,2,3};
- int i;
- printf ("Vetor antes da funcao:\n");
- for(i=0;i<tam;i++)
- {
- printf ("%d\n", vet[i]);
- }
- somaum(vet,tam);
- printf("Vetor depois da chamada da funcao:\n");
- for(i=0;i<tam;i++)
- {
- printf ("%d\n", vet[i]);
- }
- return 0;
- }
- int somaum (int *vett, int n)
- {
- int i;
- for(i=0;i<n;i++)
- {
- *(vett+i)+=1;
- }
- return vett;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement