Ponteiros em C

Mind Map by , created over 6 years ago

Mind Map on Ponteiros em C, created by felipes1474 on 07/15/2013.

52
1
0
No tags specified
 Created by felipes1474 over 6 years ago
Unit 1 Cells, exchange and transport (F211) - cells
National 5 Biology: Cell Biology
regular preterite tense conjugation -ar verbs
Narrative/Short Story Writing
Family in the park
Fractions and percentages
situation ethics
Language techniques: Macbeth
B7: Further Biology
River Landscapes
Ponteiros em C
1 Declaração do ponteiro: int *p; Endereço de uma variável: p = &c;
1.1 p "aponta" para c
2 Operações
2.1 *ip = *ip + 10;
2.2 y = *ip + 1;
2.3 ++*ip; (*ip)++;
3 Ponteiros para Arrays
3.1 int *pa; pa = &a[0];

Annotations:

• pa to point to element zero of a; that is, pa contains the address of a[0].
3.1.1 pa = pa + 1;

Annotations:

• If pa points to a particular element of an array, then by definition pa+1 points to the next element, pa+i points i elements after pa, and pa-i points i elements before. Thus, if pa points to a[0],
3.2 Códigos com mesmo significado
3.2.1 pa = &a[0]; e pa = a;
3.2.2 a[i]; e *(a + i);
3.2.3 a[i]; e pa[i];
3.2.4 a+i; e &a[i];
3.3 Atenção
3.3.1 Permitido
3.3.1.1 pa = a; e pa++;
3.3.2 Não Permitido
3.3.2.1 a = pa; e a++;
4 Ponteiros para Structs
4.1 struct node { int value; struct node *next; }
4.2 struct node { int value; struct node *left; struct node *right; }