edited
520 views
1 votes
1 votes
int main()
{
    char *p = "Good";
    char a[] = "Good";
    printf("%d\t%d\t%s\n", sizeof(p), sizeof(*p));

}


According to me ans shld be 2,1
but on running o/p is 8,1. How 8 is the o/p please explain?

edited

1 Answer

0 votes
0 votes
If machine is 64 bit then int takes 8B and char takes 1 B Hence the answer

Related questions

155
views
0 answers
1 votes
sumit goyal 1 asked Jun 28, 2017
155 views
536
views
2 answers
1 votes
Rajnish Kumar asked Jul 14, 2015
536 views
#define square(x) x*xmain(){int i;i=64/square(4);printf("%d",i);}
1.2k
views
1 answers
0 votes
851
views
1 answers
1 votes
Tushar Shinde asked Dec 30, 2015
851 views
a) A = 0, 1, 0, 0, B = 1, 0, 1, 1b) A = 1, 0, 1, 1, B = 0, 1, 0, 0c) A = 1, 1, 0, 0, B = 1, 1, 0, 0d) A = 0, 1, 0, 0, B = 0, 1, 0, 0I thought it would be (c) as previous ...