1 1 vote 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 950 views answer comment Share Follow Print See all 4 Comments 4 4 Comments reply Habibkhan commented Aug 22, 2017 reply Follow flag 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 2 replyShare sumit goyal 1 commented Aug 22, 2017 i moved by sumit goyal 1 Feb 2, 2018 reply Follow flag 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 1 replyShare Rishabh Gupta 2 commented Aug 22, 2017 reply Follow flag function country is not declared before using. 0 0 replyShare Akash Verma 1 commented Sep 17, 2017 reply Follow flag yeah, When we will run this code on any compiler it will give function prototype error. please ignore it. 0 0 replyShare Please log in or register to add a comment.
1 1 vote OUTPUT is 1; Hope so this image will clarify your doubt sandeepjkh answered Aug 23, 2017 sandeepjkh comment Share Follow 0 reply Please log in or register to add a comment.