C Program to Find the Length of a String without using the Built-in Function
This C Program finds the length of a string without using the built-in function. This program is used to find the length of the string means total number of characters present in a given string. This program need to be done without using the built-in-function. The built in functions are those which have built- in already which can be used directly.
Here is source code of the C program to finds the length of a string without using the built-in function..The C program is successfully compiled and run on a Linux system. The program output is also shown below.
* C program to find the length of a string without using the
* built-in function
int i, length =0;
printf("Enter a string \n");
/* keep going through each character of the string till its end */
for(i =0; string[i]!='\0'; i++)
printf("The length of a string is the number of characters in it \n");
printf("So, the length of %s = %d\n", string, length);
$ cc pgm52.c
Enter a string
The length of a string is the number of characters in it
So, the length of Sanfoundry = 10
Sanfoundry Global Education & Learning Series – 1000 C Programs.
Manish Bhojasia, a technology veteran with 17+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer and SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage & Cluster Administration, Advanced C Programming, SAN Storage Technologies, SCSI Internals and Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him below.
Sanfoundry is No. 1 choice for Deep Hands-ON Trainings in SAN, Linux & C, Kernel & Device Driver Programming. Our Founder has trained employees of almost all Top Companies in India. Here are few of them: VMware, Citrix, Oracle, Motorola, Ericsson, Aricent, HP, Intuit, Microsoft, Cisco, SAP Labs, Siemens, Symantec, Redhat, Chelsio, Cavium Networks, ST Microelectronics, Samsung, LG-Soft, Wipro, TCS, HCL, IBM, Accenture, HSBC, Northwest Bank, Mphasis, Tata Elxsi, Tata Communications, Mindtree, Cognizant, mid size IT companies and many Startups. Students from top Universities and colleges such as NIT Trichy, BITS Pilani, University of California, Irvine, University of Texas, Austin & PESIT Bangalore have benefited a lot from these courses as well. The assignments and real time projects for our courses are of extremely high quality with excellent learning curve.
Register for Expert Level Training Classes by our Founder & CTO. Alternatively, call us for your Corporate Training or College Training needs.