1)what is the error in the following stmt where str is a
char array and the stmt is supposed to traverse through the
whole character string str?
for(i=0;str[i];i++)
a)There is no error.
b)There shud be no ; after the stmt.
c)The cond shud be str[i]!='\0'
d)The cond shud be str[i]!=NULL
e)i shud be initialized to 1
Answer Posted / gayitri91
undoubtedly,the answer should be 'c'(the condition should be
str[i]!='\0'
correct syntax:
for(i=0;str[i]!='\0';i++)
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
What is c++ used for today?
Why array is used in c?
How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?
What does %2f mean in c?
What is main function in c?
Why is structure padding done in c?
In which language linux is written?
Why void is used in c?
plz let me know how to become a telecom protocol tester. thank you.
Are pointers really faster than arrays?
a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none
Ow can I insert or delete a line (or record) in the middle of a file?
What is the purpose of the statement: strcat (S2, S1)?
find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }
What is const keyword in c?