Uso dei puntatori.

Slides:



Advertisements
Similar presentations
#include void main() { float x = 1.66, y = 1.75; printf(%f%f,ceil(x), floor(y)); }
Advertisements

UNIT IV.
Introduction to Java 2 Programming Lecture 3 More Syntax; Working with Objects.
Introduction to Java 2 Programming Lecture 5 Array and Collections.
Etter/Ingber Arrays and Matrices. Etter/Ingber One-Dimensional Arrays 4 An array is an indexed data structure 4 All variables stored in an array are of.
11 aprile 2002 Avvisi: 1 o Esonero: mercoledi 17 aprile ore 11:30 – 14:00 consulta la pag. WEB alla voce esoneri si raccomanda la puntualita!
Incomplete Structs struct B; struct A { struct B * partner; // other declarations… }; struct B { struct A * partner; // other declarations… };
Numerical Recipes The Art of Scientific Computing (with some applications in computational physics)
Recursive Descent Technique CMSC 331. UMBC 2 The Header /* This program matches the following A -> B { '|' B } B -> C { '&' C } C -> D { '^' D } D ->
Dependency Test in Loops By Amala Gandhi. Data Dependence Three types of data dependence: 1. Flow (True) dependence : read-after-write int a, b, c; a.
Double Linked List Operations Dr. David Tsai 2010/4/12.
Program Looping EE2372 Software Design I Dr. Gerardo Rosiles.
For(int i = 1; i
Recursion Prog #include <stdio.h> #include<conio.h> main()
1 A Simple C Program /* Take a number multiply it by 10 and display it */ #include main() { int number, result; printf("Type in a number \n"); scanf("%d",
BNF <digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
Programming In C++ Spring Semester 2013 Practice 2 Programming In C++, Practice By Umer Rana.
Part 1 Landscape Hannu Laine. Pointer parameters //prototype of swap void swap(int *a, int *b); //application void main(void) { in number1 = 1, number2.
DS:Lab-1 Prepared by: Shipra Shukla Assistant Professor Kaziranga University.
Programming In C++ Spring Semester 2013 Lecture 6 Programming In C++, Lecture 6 By Umer Rana.
 Pointers, Arrays, Destructors Is this random stuff or are these somehow connected?
X-and Y-intercepts. Standard Form (of a linear equation) ax + by = c, where a, b, and c are integers.
Buffer Overflow Prabhaker Mateti Wright State University.
void count_down (int count) { for(i=count; i>1; i--) printf(" %d\t", count); } printf("A%d\n", count); if(count>1) count_down(count-1); printf("B%d\n",
Fondamenti di Informatica 1 Esercizi di riepilogo.
Array_strcpy void array_strcpy(char dest[], char src[]) { int i = 0; while (src[i] != '\0') { dest[i] = src[i]; i++; } dest[i] = '\0'; }
Sort the given string, without using string handling functions.
Case study 1: Calculate the approximation of Pi
Italian Entry+ / Level 1, lezione 24 Michel Thomas Advanced CD 2, track 4 Talk Italian 2, chapter 6, page 57.
Approfondimento Classi - Esempi1 // Argomento: Oggetti membri di altre classi // Declaration of the Date class. // Member functions defined in date1.cpp.
By Senem Kumova Metin 1 POINTERS + ARRAYS + STRINGS REVIEW.
1. What number does the following array represent?
Kirkwood Center for Continuing Education Introduction to PHP and MySQL By Fred McClurg, © Copyright 2010 All Rights Reserved. 1.
S: Application of quicksort on an array of ints: partitioning.
Презентація за розділом “Гумористичні твори”
Центр атестації педагогічних працівників 2014
Галактики і квазари.
Характеристика ІНДІЇ.
Процюк Н.В. вчитель початкових класів Боярської ЗОШ І – ІІІ ст №4
Esempi Puntatori e Stringhe1 // This program puts values into an array, sorts the values into // ascending order, and prints the resulting array. #include.
1 ร. ศ. ดร. สุเทพ มาดารัศมี Understanding Pointers in C Chapter 10 of Programming with C Book.
Духовні символи Голосіївського району
Struct 1. Definition: Using struct to define a storage containing different types. For example it can contain int, char, float and array at the same time.
Strings program. C Program to Check if a given String is Palindrome #include void main() { char string[25], reverse_string[25] = {'\0'}; int i, length.
Strings program. C Program to Check if a given String is Palindrome #include void main() { char string[25], reverse_string[25] = {'\0'}; int i, length.
LOOPING IN C. What would be the output of the following program main( ) { int j ; while ( j
Проф. д-р Васил Цанов, Институт за икономически изследвания при БАН
ЗУТ ПРОЕКТ на Закон за изменение и допълнение на ЗУТ
О Б Щ И Н А С И Л И С Т Р А П р о е к т Б ю д ж е т г.
Електронни услуги на НАП
Боряна Георгиева – директор на
РАЙОНЕН СЪД - БУРГАС РАБОТНА СРЕЩА СЪС СЪДЕБНИТЕ ЗАСЕДАТЕЛИ ПРИ РАЙОНЕН СЪД – БУРГАС 21 ОКТОМВРИ 2016 г.
Сътрудничество между полицията и другите специалисти в България
Съобщение Ръководството на НУ “Христо Ботев“ – гр. Елин Пелин
НАЦИОНАЛНА АГЕНЦИЯ ЗА ПРИХОДИТЕ
ДОБРОВОЛЕН РЕЗЕРВ НА ВЪОРЪЖЕНИТЕ СИЛИ НА РЕПУБЛИКА БЪЛГАРИЯ
Съвременни софтуерни решения
ПО ПЧЕЛАРСТВО ЗА ТРИГОДИШНИЯ
от проучване на общественото мнение,
Васил Големански Ноември, 2006
Програма за развитие на селските райони
ОПЕРАТИВНА ПРОГРАМА “АДМИНИСТРАТИВЕН КАПАЦИТЕТ”
БАЛИСТИКА НА ТЯЛО ПРИ СВОБОДНО ПАДАНЕ В ЗЕМНАТА АТМОСФЕРА
МЕДИЦИНСКИ УНИВЕРСИТЕТ – ПЛЕВЕН
Стратегия за развитие на клъстера 2015
Моето наследствено призвание
Правна кантора “Джингов, Гугински, Кючуков & Величков”
Безопасност на движението
int DP_ABString(int count) { int fa[1000], fb[1000]; if(count > 1000) return -1; memset(fa, 0, sizeof(fa)); memset(fb, 0, sizeof(fb)); for(int i.
Character Arrays char string1[] = “first”;
Presentation transcript:

Uso dei puntatori

Uso dei puntatori (1/2) #include <stdio.h> main() { int x, *p, y=2, z[10]; printf("\n/*\n"); printf("\nEs.1: int x,*p; p= &x;\n\n"); p=&x; printf(" Prima di <*p=3> x = %d\n",x); *p=3; printf(" Dopo <*p=3> x = %d\n",x); printf("\nEs.2:int x=1,y=2,z[10];p=&x;\n\n"); x=1; printf(" Prima di <y= *p> y = %d\n",y); y=*p; printf(" Dopo <y= *p> y = %d\n\n",y); printf(" Prima di <*p=0> x = %d\n",x); *p=0; printf(" Dopo <*p=0> x = %d\n",x); printf("\n*/\n"); }

Uso dei puntatori (2/2) /* Es.1: int x,*p; p= &x; Prima di <*p=3> x = 0 Dopo <*p=3> x = 3 Es.2:int x=1,y=2,z[10]; p=&x; Prima di <y= *p> y = 2 Dopo <y= *p> y = 1 Prima di <*p=0> x = 1 Dopo <*p=0> x = 0 */

Puntatori e Array (1/2) #include <stdio.h> main() { int a[10], *pa, i; pa= &a[0]; printf("\n/* Esempi sull'uso dei puntatori\n\n"); for (i=0;i<10;i++) a[i]=i; printf("a[%d]=%d; *(pa+%d)=%d; pa[%d]=%d\n",i,a[i],i,*(pa+i),i,pa[i]); } printf("\n*/\n");

Puntatori e Array (2/2) /* Esempi sull'uso dei puntatori a[0]=0; *(pa+0)=0; pa[0]=0 a[1]=1; *(pa+1)=1; pa[1]=1 a[2]=2; *(pa+2)=2; pa[2]=2 a[3]=3; *(pa+3)=3; pa[3]=3 a[4]=4; *(pa+4)=4; pa[4]=4 a[5]=5; *(pa+5)=5; pa[5]=5 a[6]=6; *(pa+6)=6; pa[6]=6 a[7]=7; *(pa+7)=7; pa[7]=7 a[8]=8; *(pa+8)=8; pa[8]=8 a[9]=9; *(pa+9)=9; pa[9]=9 */

VETTORI, PUNTATORI e FUNCTION PROTOTIPO void leggivet (int[], int); void leggivet (int *, int);   DICHIARAZIONE int vet[10], dim; int *vet, dim; vet=(int *)malloc(dim*sizeof(int)); vet=(int *)calloc(dim, sizeof(int)); CHIAMATA leggivet (vet, dim); leggivet (&vet[0], dim); DEFINIZIONE void leggivet (int par[], int ind) void leggivet (int *par, int ind); USO par[j]=temp; *(par+j)=temp;

MATRICI, PUNTATORI e FUNCTION (1/2) PROTOTIPO void leggimat (int[][10], int); void leggimat (int **, int);   DICHIARAZIONE int mat[10][10], ri, co; int **mat, ri, co; mat=(int *)malloc(ri*sizeof(int)); mat=(int *)calloc(ri, sizeof(int)); for (i=0;i<ri;++i) mat[i]=(int*)malloc(co*sizeof(int)); mat[i]=(int*)calloc(ri,sizeof(int));

MATRICI, PUNTATORI e FUNCTION (2/2) CHIAMATA leggimat (mat, dim); leggimat (&mat[0], dim);   DEFINIZIONE void leggimat (int par[][10], int ind) void leggivet (int **par, int ind); USO par[j][k]=temp; *(*(par+j)+k)=temp;