C语言 输出输入
例如
scanf(“%2d,%*3d,%2d”)
只有前后的两个字符,而中间三个就没了
a = " "
scanf(“%s”,a)
print(“%d”,a)
那么就是0对应的32
空格在字符型中是有效字符
去掉垃圾字符
#include <stdio.h>
int main(int argc, char *argv[])
{
int a;
char x;
printf(“>”);
scanf(“%d”,&a);
//getchar();
scanf(" %c",&x);
pr intf(“%d :%c : %d\n”,a ,x,x);
return 0;
scanf输入不能用空格,gets()可以用空格;
puts()可以自动换行
man sqrt
NAME
sqrt, sqrtf, sqrtl - square root function
SYNOPSIS
#include <math.h>
double sqrt(double x);
float sqrtf(float x);
long double sqrtl(long double x);
Link with -lm.