int func1(int array[]){
for(int i=0; i<4; i++){
printf("value at %d is %d\n",i,array[i]);
}
/* array[0]=382; if you change any value it gets reflected in main*/
return 0;
}
void func2(int*ptr){
for(int i=0; i<4; i++){
printf("value at %d is %d\n",i,*(ptr+i));
}
*(ptr+2)=354;
}
void func3(int arr[2][2]){
for(int i=0; i<2; i++){
for(int j=0; j<2; j++){
printf("value at %d,%d is %d\n",i,j,arr[i][j]);
}
}
}
int main() {
// int arr[][2]={{23,13,3,4},{9,3}};
int arr[]={23,13,3,4};
printf("value at index 0 is %d\n",arr[0]);
func1(arr);
printf("value at index 0 is %d\n",arr[0]);
func2(arr);
func2(arr);
// func3(arr);
return 0;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter