207k views
4 votes
Write an expression whose value is the string that consists of the first four characters of string s.

User Oparisy
by
4.9k points

1 Answer

3 votes

Answer:

The correct expression for the following question is :s[0 : 4]

Step-by-step explanation:

The string is the collection of characters It terminated by the NULL character in the c programming language. The s[0 : 4] expression holds the first four characters of string s. In the expression it starts to the position "0" and goes to the index value "4" .in this string it holds the value up to the four characters.

We can store the four-character in the string:s[0 : 4].

User KItis
by
5.5k points