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 / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)

1853


What is meant by keywords in c?

609


By using C language input a date into it and if it is right?

565


How many main () function we can have in a project?

602


What is modifier & how many types of modifiers available in c?

598






Does * p ++ increment p or what it points to?

601


Explain what is operator promotion?

621


What is conio h in c?

612


What is the difference between null pointer and wild pointer?

626


What library is sizeof in c?

557


What is the difference between constant pointer and constant variable?

740


main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above

608


Why functions are used in c?

578


What is the collection of communication lines and routers called?

604


What is wrong in this statement?

595