1 votes 1 votes What will be the output of the following program-? int main() { char *str="india"; printf("%d\n",country(str)); return 0; } int country(int *p1) { int *p2=p1; while(*++p1) { return (p1-p2); } } Programming in C programming-in-c + – Akash Verma 1 asked Aug 22, 2017 retagged May 20, 2021 by Shiva Sagar Rao Akash Verma 1 536 views answer comment Share Follow See all 4 Comments See all 4 4 Comments reply Habibkhan commented Aug 22, 2017 reply Follow Share In the main function , we are providing address of the string constant...Whereas in the function definition the pointer is to integer type not character ...Hence the compiler issues a warning saying incompatible data type.. 2 votes 2 votes sumit goyal 1 commented Aug 22, 2017 i moved by sumit goyal 1 Feb 2, 2018 reply Follow Share output 1 , is coming when int *p1 executes then it is holding address like 234556 you can check it and inspect it in turbo c , 1 votes 1 votes Rishabh Gupta 2 commented Aug 22, 2017 reply Follow Share function country is not declared before using. 0 votes 0 votes Akash Verma 1 commented Sep 17, 2017 reply Follow Share yeah, When we will run this code on any compiler it will give function prototype error. please ignore it. 0 votes 0 votes Please log in or register to add a comment.
1 votes 1 votes OUTPUT is 1; Hope so this image will clarify your doubt sandeepjkh answered Aug 23, 2017 sandeepjkh comment Share Follow See all 0 reply Please log in or register to add a comment.