how to find string length wihtout using c function?

Answer Posted / ruchi

#include<conio.h>
#include<stdio.h>
int main()
{
char a[10];
int i=0,c,length=0;
printf("\nEnter the string ");
while((a[i++]=getchar())!='\n');
printf("\nThe lengh of the string is ");
i=i-1;
printf("%d",i);
getch();
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is multithreading possible in c?

568


Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"

1582


Can we use visual studio for c?

553


Is c weakly typed?

580


How to get string length of given string in c?

610






Explain the difference between malloc() and calloc() function?

603


What are the advantages and disadvantages of a heap?

715


What is the meaning of c in c language?

597


What are the complete rules for header file searching?

677


The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none

767


Explain what is the concatenation operator?

628


Explain the difference between the local variable and global variable in c?

605


How can I open a file so that other programs can update it at the same time?

663


What is the basic structure of c?

557


What is sizeof array in c?

596