a memory of 20 bytes is allocated to a string declared as
char *s then the following two statements are executed:
s="Etrance"
l=strlen(s);
what is the value of l ?
a.20
b.8
c.9
d.21
Answers were Sorted based on User's Feedback
Answer / fazlur rahaman naik
the string is Entrance or Etrance?
if it is Entrance,then only the answer is here.
b is the right answer.
because string length means it will count only the no.of
characters in that string only...not the null character.
| Is This Answer Correct ? | 23 Yes | 1 No |
Answer / subbu
l=7 is the right answer, which is not given in the options.
| Is This Answer Correct ? | 10 Yes | 8 No |
Answer / valli
20 bytes of memory is allocated to s
hence
l=strlen(s);//l=20
so answer is a
| Is This Answer Correct ? | 2 Yes | 14 No |
Answer / sivasankar.a
the answer is c)9 because of "etrance"this word lengh is 9.
| Is This Answer Correct ? | 3 Yes | 19 No |
How can you increase the size of a dynamically allocated array?
what's the return value of malloc()
What is the function of volatile in c language?
Difference between macros and inline functions? Can a function be forced as inline?
0 Answers HAL, Honeywell, Zomato,
what is out put of the following code? #include class Base { Base() { cout<<"constructor base"; } ~Base() { cout<<"destructor base"; } } class Derived:public Base { Derived() { cout<<"constructor derived"; } ~Derived() { cout<<"destructor derived"; } } void main() { Base *var=new Derived(); delete var; }
What are 3 types of structures?
#include<string.h> void main() { String s1[]={"swathi"}; string s2[]={"maddimsetti"}; s1[]=s[]; printf("%s",s1[]); }
What does typeof return in c?
What are the features of the c language?
What will be the result of the following C language program? main() { int a = 0; int b = 20; char x = 1; char y = 10; if(a,b,x,y) printf("Welcome"); }
What is #include in c?
What is data structure in c programming?