Sunday 16 May 2021

String Taxonomy in C programming

In C, we can store a string either in fixed length format or variable length format. A string is a sequence of characters or an array of characters ended with null character.


1. Fixed length strings: 

When storing a string in a fixed length format, you need to specify an appropriate size for the string variable. If the size is too small, then you will not able to store all the elements in the string. On the other hand, of the string size is large then unnecessary memory space will be wasted.

2. Variable length string:

A better option us to use variable length format in which the string size can be increased or decreased to store the elements in it. Variable length technique indicate the end of the elements by using length controlled string or delimiter.

a) Length controlled string:

In the length controlled string, you need to specify the number of characters in the string. This count is used by the string manipulation functions to determine the actual length of the string variable.

b) Delimited string:

In this format, the string is ended with a delimiter, usually a null character. The delimiter is used to identify the end of  the string.

0 comments :

Post a Comment

Note: only a member of this blog may post a comment.

Machine Learning

More

Advertisement

Java Tutorial

More

UGC NET CS TUTORIAL

MFCS
COA
PL-CG
DBMS
OPERATING SYSTEM
SOFTWARE ENG
DSA
TOC-CD
ARTIFICIAL INT

C Programming

More

Python Tutorial

More

Data Structures

More

computer Organization

More
Top