Home  >  Article  >  Backend Development  >  What does %ld mean in C language?

What does %ld mean in C language?

Guanhui
GuanhuiOriginal
2020-06-03 11:19:3928181browse

What does %ld mean in C language?

What does %ld mean in C language?

"%ld" in C language is a type in the format specifier, that is, the format output input symbol. Its function is to convert the input or output data according to the format specified by the format specifier. For input or output, this type represents data input or output as decimal signed long integer.

Other types

What does %ld mean in C language?

##Sample code

#include <stdio.h>
int main(){
  int i; long l; unsigned int u;//定义三个不同类型的变量。 scanf("%d%ld%u",&i,&l,&u);//格式化输入三种变量,每个对应自己的类型。 
  printf("i = %d\n", i); 
  printf("l = %ld\n", l); 
  printf("u = %u\n", u);//分行格式化输出三个变量的值。 
  return 0;
}
如果输入1 2 3将输出
i = 1l = 2u = 3

Recommended tutorial: "

C#"

The above is the detailed content of What does %ld mean 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