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


Please Help Members By Posting Answers For Below Questions

What is the modulus operator?

725


What is the use of a semicolon (;) at the end of every program statement?

752


What is the use of in c?

564


main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }

625


Write a program that accept anumber in words

1242






What is the difference between ‘g’ and “g” in C?

2493


What is the acronym for ansi?

619


What does s c mean in text?

600


Is c pass by value or reference?

583


Explain what’s a signal? Explain what do I use signals for?

601


What is dynamic variable in c?

551


how to create duplicate link list using C???

2055


What is the difference between functions getch() and getche()?

609


What are the disadvantages of external storage class?

579


How do you use a pointer to a function?

621