-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewfile.c
45 lines (43 loc) · 842 Bytes
/
newfile.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/mman.h>
#include <semaphore.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
void funzione(int*);
void funzione2(char*);
int main(int argc, char **argv)
{
int b = 1024;
int h[5] = {0,1,2,3,4};
int *ptr = &h[0];
int *ptr2 = &b;
char buffer[1024] = "mammina mia";
//char *buffer = "mammina mia"; //uguale
//char *bu = &buffer[0]
funzione(ptr);
funzione2(buffer);
return 0;
}
void funzione(int *ptr)
{
int valore = 5;
while(valore--)
printf("Valore = %d \n", *ptr++);
return;
}
void funzione2(char *ptr)
{
int valore = strlen(ptr);
while(valore--)
printf("Valore carattere = %c \n", *ptr++);
}