how to generate the length of a string without using len
funtion?

Answer Posted / dattathreya

The below function should do it:

int strLength(char *s)
{
int i;
for(i = 0; s[i]; i++);
return i;
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how do you determine whether to use a stream function or a low-level function?

634


What are pointers? What are stacks and queues?

586


Explain what are run-time errors?

615


what is the difference between class and unio?

1874


Explain a file operation in C with an example.

668






What are the 5 types of organizational structures?

556


What are qualifiers?

621


please give me some tips for the placement in the TCS.

1641


What is the use of #define preprocessor in c?

623


Why isn't any of this standardized in c? Any real program has to do some of these things.

631


When should you not use a type cast?

666


What are volatile variables in c?

533


1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.

1671


any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above

652


How would you obtain the current time and difference between two times?

736