• retagged by
950 views
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);
     }
 }

1 Answer

Position:
Show:

Related questions

18 18 votes
2 2 answers
770
770 views
GO Classes asked Jul 2
770 views
Assume:struct Student { double gpa; }; struct Student alice; struct Student *sptr = &alice;Which of the following correctly assigns $\texttt{4.0}$ to $\texttt{alice.gpa}$...
12 12 votes
2 2 answers
548
548 views
GO Classes asked Jul 1
548 views
What is the output of the following code?#include <stdio.h void func(int a, int *bptr) { a = 42; *bptr = 42; return; } int main(void) { int x = 100, y = 100; func(x, &y);...
8 8 votes
3 3 answers
448
448 views
GO Classes asked Jun 30
448 views
What is the output of the following code?#include <stdio.h struct Student { int roll; int marks; }; int main() { struct Student s[3] = { {1, 50}, {2, 60}, {3, 70} }; stru...
8 8 votes
2 2 answers
381
381 views
GO Classes asked Jun 30
381 views
What will happen when the following code is compiled?#include <stdio.h struct Node { int data; }; int main() { struct Node n = {25}; struct Node *p = &n; printf("%d", *p....