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 |
What is the difference between macros and inline functions?
How to create struct variables?
f=(x>y)?x:y a) f points to max of x and y b) f points to min of x and y c)error
I need to take a sentence from input and sort the words alphabetically using the C programming language. Note: This is C not C++. qsort and strtok not allowed
How to write a code for random pick from 1-1000 numbers? The output should contain the 10 numbers from the range 1-1000 which should pick randomly, ie ,for each time we run the code we should get different outputs.
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it?
Array is an lvalue or not?
Explain what is page thrashing?
Can I initialize unions?
Write a program that receives as input a number omaadel-n-print, four digits.
for(i=0;i=printf("Hello");i++); printf("Hello"); how many times how will be printed?????????
Explain output of printf("Hello World"-'A'+'B'); ?