0 votes 0 votes #include<stdio.h> int fun(int arr[]) { arr=arr+1; printf("%d",arr[0]); } int main(void){ int arr[2]={10,20}; fun(arr); printf("%d",arr[0]); return 0; } A.COMPILE ERROR B.20,10 C.10,20 D.20,20 Programming in C parameter-passing + – Arun Rout asked Jan 7, 2019 Arun Rout 735 views answer comment Share Follow See all 4 Comments See all 4 4 Comments reply Shobhit Joshi commented Jan 7, 2019 reply Follow Share B ? 0 votes 0 votes kumar.dilip commented Jan 7, 2019 reply Follow Share See this code to understand. #include<stdio.h> int fun(int a[]) { a=a+1; printf("%d ",a[0]); printf("%d ", a[1]); } int main(void){ int arr[2]={10,20}; fun(arr); printf("%d %d ",arr[0], arr[1]); return 0; } 0 votes 0 votes pawan kumarln commented Jan 7, 2019 reply Follow Share i m thinking compiler error array base address can not be changed 0 votes 0 votes Arun Rout commented Jan 7, 2019 reply Follow Share not compile error it gives output but i want know the procees of execution. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes int fun(int arr[]) // arr will point to first element of the array { arr=arr+1; // now arr will point to next element printf("%d",arr[0]); // Second element is 20 & it will print } int main(void){ int arr[2]={10,20}; fun(arr); printf("%d",arr[0]); // first element is 10 ,So it will print that value. return 0; } Arun Rout answered Jan 10, 2019 Arun Rout comment Share Follow See all 0 reply Please log in or register to add a comment.