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.
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:
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!