Question
A.
int xstrlen(char *s)
{
int length=0;
while(*s!='\0')
{ length++; s++; }
return (length);
}
B.
int xstrlen(char s)
{
int length=0;
while(*s!='\0')
length++; s++;
return (length);
}
C.
int xstrlen(char *s)
{
int length=0;
while(*s!='\0')
length++;
return (length);
}
D.
int xstrlen(char *s)
{
int length=0;
while(*s!='\0')
s++;
return (length);
}
a.
A
b.
B
c.
C
d.
D
Posted under C Programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. Which of the following function is correct that finds the length of a string?
Similar Questions
Discover Related MCQs
Q. Which standard library function will you use to find the last occurance of a character in a string in C?
View solution
Q. What is the purpose of fflush() function.
View solution
Q. Can you use the fprintf() to display the output on the screen?
View solution
Q. Which of the following are correct preprocessor directives in C?
1: #ifdef
2: #if
3: #elif
4: #undef
View solution
Q. Which of the following are correctly formed #define statements in C?
View solution
Q. In the following code, the P2 is Integer Pointer or Integer?
typedef int *ptr;
ptr p1, p2;
View solution
Q. In the following code what is 'P'?
typedef char *charp;
const charp P;
View solution
Q. Which header file should be included to use functions like malloc() and calloc()?
View solution
Q. What function should be used to free the memory allocated by calloc() ?
View solution
Q. Specify the 2 library functions to dynamically allocate memory?
View solution
Q. Which of the following statement is correct prototype of the malloc() function in c ?
View solution
Q. What is the return type of malloc() or calloc()?
View solution
Q. Which function is used to delete the allocated memory space?
View solution
Q. Among 4 header files, which should be included to use the memory allocation functions like malloc(), calloc(), realloc() and free()?
View solution
Q. Which of the following is/are true?
View solution
Q. Which languages necessarily need heap allocation in the run time environment?
View solution
Q. malloc() returns a float pointer if memory is allocated for storing float's and a double pointer if memory is allocated for storing double's.
View solution
Q. malloc() allocates memory from the heap and not from the stack.
View solution
Q. Where does the uninitialized data gets stored in memory?
View solution
Q. malloc() returns a NULL if it fails to allocate the requested memory.
View solution
Suggested Topics
Are you eager to expand your knowledge beyond C Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!