Send Close Add comments: (status displays here)
Got it!  This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
Simple strings in C


1. Simple strings in C
A character string is a sequence of characters.

C has limited (and cumbersome) string handling.

For now, we will just input and output text and not do text processing.

2. String input and echo
Below is a simple C program to do string input and output. Note the following. Here is the C code.


3. Examples of input and output
Here are some examples of input and output for the above program code.

Here is an example input.

For the above example input, here is the expected output.

Here is an example input.

For the above example input, here is the expected output.


4. Mixed input types
The following C program shows how to input an integer followed by a text string. Note the following. Here is the C code.


5. Examples of input and output
Here are some examples of input and output for the above program code.

Here is an example input.

For the above example input, here is the expected output.

Here is an example input.

For the above example input, here is the expected output.

Here is the output of the C code.

6. End of page