0% found this document useful (0 votes)
33 views1 page

Lab 3

The document contains a C program that calculates the length of the string 'Programming is fun'. It uses a loop to count characters until it reaches the null terminator. The output of the program is the length of the string, which is 18.

Uploaded by

SUJAL GUPTA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views1 page

Lab 3

The document contains a C program that calculates the length of the string 'Programming is fun'. It uses a loop to count characters until it reaches the null terminator. The output of the program is the length of the string, which is 18.

Uploaded by

SUJAL GUPTA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

/*PRE-REQUISITE LAB 3

Program for length of a string*/


#include <stdio.h>
int main() {
char s[] = "Programming is fun";
int i;

for (i = 0; s[i] != '\0'; ++i);


printf("Length of the string: %d", i);
return 0;
}

OUTPUT:
Length of the string: 18

You might also like