Documente Academic
Documente Profesional
Documente Cultură
For example,
float mark[5];
Working of Pointers
7. #include <stdio.h>
8. int main()
9. {
10. int* pc, c;
11.
12. c = 22;
13. printf("Address of c: %p\n", &c);
14. printf("Value of c: %d\n\n", c); // 22
15.
16. pc = &c;
17. printf("Address of pointer pc: %p\n", pc);
18. printf("Content of pointer pc: %d\n\n", *pc); // 22
19.
20. c = 11;
21. printf("Address of pointer pc: %p\n", pc);
22. printf("Content of pointer pc: %d\n\n", *pc); // 11
23.
24. *pc = 2;
25. printf("Address of c: %p\n", &c);
26. printf("Value of c: %d\n\n", c); // 2
27. return 0;
28. }
Assignment 4:
1. Store Numbers and Calculate Average Using Arrays
2. Write a program in C to add numbers using call by reference.
3. Write a program in C to find the maximum number between two numbers using
a pointer.
4. Write a program in C to swap elements using call by reference.
5. Write a program in C to find the factorial of a given number using pointers.
6. Write a C program to reverse an array using pointers.
7. Write a C program to access two dimensional array using pointers.
8. Write a C program to add two matrix using pointers.
9. Write a C program to multiply two matrix using pointers.
10. Write a C program to copy one array to another using pointers.