Home  >  Article  >  Backend Development  >  How to output a string in c language

How to output a string in c language

藏色散人
藏色散人Original
2018-12-10 14:29:2447042browse

C language outputs simple strings, such as strings related to personal information, including name, date of birth, and number. We can directly print out the specified information string through the printf() function.

How to output a string in c language

Recommended tutorial: "C Video Tutorial"

Below we will introduce C language output to you through simple code examples. Implementation method of personal information related strings.

The code example is as follows:

#include <stdio.h> 
 int main()  
  {
     printf("Name   : Alexandra Abramov\n"); 
     printf("DOB    : July 14, 1975\n"); 
     printf("Mobile : 99-9999999999\n"); 
     return(0); 
  }

The output result is as follows:

How to output a string in c language

##As shown in the figure, name, date of birth, The string of the number is printed successfully.

Related knowledge introduction:

int main() is a way of declaring the main function in C language.

return 0 means the program exits normally.

printf() function is a formatted output function, generally used to output information to the standard output device in a specified format

The calling format of the printf() function is:

 printf("<格式化字符串>", <参量表>)。

Note: The printf function is essential in C language. As long as the printf function has output, printf is generally used. Printf can output most of the C language. The content, such as integers, floating point numbers, characters, and strings, is not unique. For example, strings can call the puts function, and characters can call the putchar function to output.

This article is a brief introduction to using C language to output personal information, that is, name, date of birth, and number. It is very simple and easy to understand. I hope it will be helpful to friends in need!

The above is the detailed content of How to output a string in c language. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn