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 the difference between null pointer and wild pointer?
Differentiate between new and malloc(), delete and free() ?
What are qualifiers and modifiers c?
How can you increase the allowable number of simultaneously open files?
Why are all header files not declared in every c program?
Between macros and functions,which is better to use and why?
What is a union?
Why flag is used in c?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)
Explain how can type-insensitive macros be created?
Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.
write an algorithm to display a square matrix.
What is type qualifiers?
Which one would you prefer - a macro or a function?
Write a program to identify if a given binary tree is balanced or not.