Embed presentation
Download to read offline






![Arrays and
Pointers
Output ?
7/16/2016 7
#include <stdio.h>
int MAX = 3;
int main ()
{
int var[] = {10, 100, 200};
int i, *ptr[MAX];
for ( i = 0; i < MAX; i++)
{
ptr[i] = &var[i];
}
for ( i = 0; i < MAX; i++)
{
printf("Value of var[%d] = %dn", i, *ptr[i] );
}
return 0; }](https://image.slidesharecdn.com/pointers-160716152535/85/Pointers-7-320.jpg)
![Output ?
7/16/2016 8
#include <stdio.h>
const int MAX = 4;
int main ()
{
char *names[] = { "Zara Ali",
"Hina Ali", "Nuha Ali", "Sara Ali", };
int i = 0;
for ( i = 0; i < MAX; i++)
{
printf("Value of names[%d] = %sn", i, names[i] );
}
return 0;
}](https://image.slidesharecdn.com/pointers-160716152535/85/Pointers-8-320.jpg)


The document contains 10 code snippets demonstrating the use of pointers in C programming. It shows how to declare and dereference pointers, pass pointers to functions, use pointers to arrays and strings, and pointers to pointers. The snippets output the values of pointers, addresses of variables, and values pointed to via pointers. This allows the reader to learn how pointers work and see examples of common pointer operations in C.






![Arrays and
Pointers
Output ?
7/16/2016 7
#include <stdio.h>
int MAX = 3;
int main ()
{
int var[] = {10, 100, 200};
int i, *ptr[MAX];
for ( i = 0; i < MAX; i++)
{
ptr[i] = &var[i];
}
for ( i = 0; i < MAX; i++)
{
printf("Value of var[%d] = %dn", i, *ptr[i] );
}
return 0; }](https://image.slidesharecdn.com/pointers-160716152535/85/Pointers-7-320.jpg)
![Output ?
7/16/2016 8
#include <stdio.h>
const int MAX = 4;
int main ()
{
char *names[] = { "Zara Ali",
"Hina Ali", "Nuha Ali", "Sara Ali", };
int i = 0;
for ( i = 0; i < MAX; i++)
{
printf("Value of names[%d] = %sn", i, names[i] );
}
return 0;
}](https://image.slidesharecdn.com/pointers-160716152535/85/Pointers-8-320.jpg)

