[ create a new paste ] login | about

Link: http://codepad.org/Q8b1jqfj    [ raw code | output | fork ]

slevy1ster - C, pasted on May 16:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
void fun(int ptr[])
{
int i;
unsigned int n = sizeof(ptr)/sizeof(ptr[0]);
puts("In fun ....");
printf("Size of ptr and ptr[0]: %d %d",sizeof(ptr),sizeof(ptr[0]));
printf("\nTesting: %d",n);
for (i=0; i<n; i++)
 printf("\nThe ptr val: %d  ", ptr[i]);
}

// Driver program
int main()
{
int arr[] = {1, 2, 3, 4, 5, 6, 7, 8};
fun(arr);
return 0;
}


Output:
1
2
3
4
In fun ....
Size of ptr and ptr[0]: 4 4
Testing: 1
The ptr val: 1  


Create a new paste based on this one


Comments: