#include <stdio.h>
/**
* main - entry point
* Return: Always sucess (0)
*/
int main(void)
{
/* Declaring vars */
int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int i;
int* parr = arr;
/* Try to iterate by pointer incrementation */
for (; *parr != '\0'; parr++)
{
/* output: arr elements plus an unknown element */
printf("%d ", *parr);
}
printf("\n");
/* Try to iterate by index */
for (i = 0; i < 10; i++)
{
/* output: arr elements exactly as they are */
printf("%d ", arr[i]);
}
printf("\n");
/* Try to iterate by both index and pointer */
for (i = 0; i < 10; i++)
{
/* output: arr elements in hexadecimal format */
printf("%p ", *&arr[i]);
}
return (0);
}
#include <stdio.h>
/**
* main - entry point
* Return: Always sucess (0)
*/
int main(void)
{
/* Declaring vars */
int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int i;
int* parr = arr;
/* Try to iterate by pointer incrementation */
for (; *parr != '\0'; parr++)
{
/* output: arr elements plus an unknown element */
printf("%d ", *parr);
}
printf("\n");
/* Try to iterate by index */
for (i = 0; i < 10; i++)
{
/* output: arr elements exactly as they are */
printf("%d ", arr[i]);
}
printf("\n");
/* Try to iterate by both index and pointer */
for (i = 0; i < 10; i++)
{
/* output: arr elements in hexadecimal format */
printf("%p ", *&arr[i]);
}
return (0);
}