Experiment-6: Pointers
1. What will happen in this code?
int a = 100, b = 200;
int *p = &a, *q = &b;
p = q;
printf(p);
2. What will be the output ?
int *ptr = 0;
int a = 10;
*ptr = a;
Printf( *ptr);
3. What will be the output ?
int a = 10;
int *p = &a;
int **q = &p;
int b = 20;
*q = &b;
(*p)++;
Printf(a, b);
4. Find the output :
int arr[] = {4, 5, 6, 7};
int *p = (arr + 1);
printf(*arr + 9);
5. Write a C program to swap two numbers using pointers
6. Write a C program to copy one array to another using pointers
7. Write a C program to find largest and smallest elements in an array.
8. Write a C program to add two NxN matrices using pointers.