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 |
program for reversing a selected line word by word when multiple lines are given without using strrev
What does == mean in texting?
why division operator not work in case of float constant?
Does c have circular shift operators?
What are the uses of a pointer?
Can we increase size of array in c?
What is the process to generate random numbers in c programming language?
what is the difference b/w NULL and null?
#define MAX 3 main() { printf("MAX = %d \n",MAX ); #undef MAX #ifdef MAX printf("Vector Instituteā); #endif
wht is the difference between KPO and BPO ?
2 Answers Accenture, BPO, HCK, HCL, Infosys,
Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Quick Sort 2) Bubble Sort 3) Merge Sort
How does sizeof know array size?