#include <stdio.h>
int fun1(int* ptr)
{
for (int i = 0; i < 4; ++i) {
printf("The value of %d is %d\n",i,ptr[i]); //or
printf("The value of %d is %d\n",i,*(ptr+i)); // both do the same work
}
*(ptr+2)=58; //value gets changed of 2nd index of array
}
int main ()
{
int arr[]={2,4,6,8};
fun1(arr);
fun1(arr);
return 0;
}
/*Type Casting in C Typecasting allows us to convert one data type into other. */ //simple example to cast int value into the float. #include <stdio.h> int main (){ float f = ( float ) 9 / 4 ; printf ( "f : %f \n " , f ); return 0 ; }
Comments
Post a Comment