main()

{

char *str1="abcd";

char str2[]="abcd";

printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd"));

}



main() { char *str1="abcd"; char str2[]="abcd"; printf("%d ..

Answer / susie

Answer :

2 5 5

Explanation:

In first sizeof, str1 is a character pointer so it gives you
the size of the pointer variable. In second sizeof the name
str2 indicates the name of the array whose size is 5
(including the '\0' termination character). The third sizeof
is similar to the second one.

Is This Answer Correct ?    14 Yes 3 No

Post New Answer

More C Code Interview Questions

Cluster head selection in Wireless Sensor Network using C programming language.

0 Answers  


#include<stdio.h> main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); }

2 Answers   CNSI,


main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; printf("\n%d %d %d",a,*f1,*f2); }

6 Answers  


#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }

1 Answers  


write a program in c to merge two array

2 Answers  






Which version do you prefer of the following two, 1) printf(ā€œ%sā€,str); // or the more curt one 2) printf(str);

1 Answers  


how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.

0 Answers   Mbarara University of Science and Technology,


void main() { while(1){ if(printf("%d",printf("%d"))) break; else continue; } }

1 Answers  


main() { char c; int i = 456; clrscr(); c = i; printf("%d", c); } a. 456 b. -456 c. random number d. none of the above

3 Answers   BrickRed, HCL,


Declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

1 Answers  


Finding a number multiplication of 8 with out using arithmetic operator

8 Answers   Eyeball, NetApp,


Display the time of the system and display the right time of the other country

1 Answers  


Categories