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
Answers were Sorted based on User's Feedback
Answer / rajesh
options A and C are correct....
Check it in C programming online editor www.codepad.org
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / 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 |
Why do we use static in c?
how to write a program which adds two numbers without using semicolon in c
why array index always starts from zero??
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?
How does C++ help with the tradeoff of safety vs. usability?
Explain what are the different data types in c?
what does ‘#include’ mean?
What are nested functions in c?
How can I find leaf node with smallest level in a binary tree?
How can I sort more data than will fit in memory?
what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above
write a program wch produces its own source code aas its output?