Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int fun(int **tab[], int n){
- int s=0, i, temp=0, j,tempa,tempb;
- for(i=0; i<n; i++)
- {
- printf("suma obecna: %d\n",s);
- printf("Wartosc: %d\n", *(tab+i));
- printf("Adres: %p\n", tab+i);
- temp=*(tab+i);
- s=s+temp;
- printf("suma po dodaniu: %d\n",s);
- j=i+1;
- for(j; j<n; j++) {
- tempa=*(tab+i);
- tempb=*(tab+j);
- printf("Wartosc porownywana: %d\n", *(tab+i));
- printf("Wartosc do ktorej porownujemy: %d\n", *(tab+j));
- if(tempa==tempb) *(tab+j)=0;
- printf("Wartosc po wyzerowaniu: %d\n", *(tab+i));
- }
- }
- return s;
- }
- int main(){
- int *tab[]={1,2,1,2,3,4,3,4,5};
- printf("%d ", fun(tab,9));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement