Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Pokazivači

Pokazivači (pointers) u programskom jeziku C
by

Damir Nemcanin

on 13 November 2013

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Pokazivači

Programiranje
Pokazivači
Primjeri
int a, *pa;
pa = &a;
printf("Upisi broj ");
scanf("%d", &a);
printf("a:%d\tpa=%d\n", a,*pa);
*pa = 100;
printf("a:%d\tpa=%d\n", a,*pa);
int a=10;
int *pa;
pa = &a;
printf("adresa = %ld\tvrijednost = %d\n", &a, a);
printf("adresa = %ld\tvrijednost = %ld\tpokazuje = %d\n",&pa, pa,*pa);
Pokazivač kao argument funkcije
možemo mijenjati više od jedne varijable
prijenos polja

void funkcija(int *pa, int *pb){
*pa = X;
*pb = Y;
}

Primjeri
void zamjeni(int *pa, int *pb){
int t=*pb;
*pb=*pa;
*pa=t;
}
main...
zamjeni(&a, &b);
Računanje Opsega i Površine
void pravokutnik(int a, int b,
int *opseg, int *povrsina){
*opseg = 2 * a + 2 * b;
*povrsina = a * b;
}
char *chptr = (char*)2;
printf("Char pointer - prije: %p\n", chptr);
chptr++;
printf("Char pointer - poslije: %p\n", chptr);

int *iptr = (int*)4;
printf("int pointer - prije: %p\n", iptr);
iptr++;
printf("int pointer - poslije: %p\n", iptr);
char pointer - prije:
0x2
char pointer - poslije:
0x3
int pointer - prije:
0x4
int pointer - poslije:
0x8
Full transcript