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? anonymous asked Aug 14, 2016 • edited Aug 14, 2016 anonymous 520 views answer comment Share Follow See all 4 Comments See all 4 4 Comments reply Kapil commented Aug 14, 2016 reply Follow Share Your machine is 64 bit , hence it returns 8. if it were 32 bit, then it returns 4. why last output is 4 ? you want to print %s right? 0 votes 0 votes anonymous commented Aug 14, 2016 reply Follow Share Edited the question. Thanks I found out what I was doing wrong. 1 votes 1 votes pC commented Aug 23, 2016 reply Follow Share @Kapil sir pls explain the reason why did we get 8 and 1 ? 0 votes 0 votes pC commented Aug 23, 2016 reply Follow Share Got it :) 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes If machine is 64 bit then int takes 8B and char takes 1 B Hence the answer pC answered Aug 23, 2016 pC comment Share Follow See all 0 reply Please log in or register to add a comment.