Linguagem C
Funções Padrões
Lógica de Programação
Abs
A função abs retorna o valor inteiro positivo – absoluto.
Sintaxe: int abs (int x);
Prototype: math.h e stdlib.h
Fabs
A função fabs retorna o valor real positivo – absoluto.
Sintaxe: float fabs (float x);
Prototype: math.h e stdlib.h
Asin
A função asin retorna o valor do arco seno. A variável x deve estar em
radianos.
Sintaxe: double asin (double x);
Prototype: math.h
Faixa: -pi / 2 à pi / 2
Acos
A função acos retorna o valor do arco cosseno. A variável x deve estar em
radianos.
Sintaxe: double acos (double x);
Prototype: math.h
Faixa: 0 à pi
Atan
A função atan retorna o valor do arco tangente. A variável x deve estar em
radianos.
Sintaxe: double atan (double x);
Prototype: math.h
Faixa: -pi / 2 à pi / 2
Cos
A função cos retorna o valor do cosseno. A variável x deve estar em
radianos.
Sintaxe: double cos (double x);
Prototype: math.h
Faixa: -1 a1
Sin
A função sin retorna o valor do seno. A variável x deve estar em radianos.
Sintaxe: double sin (double x);
Prototype: math.h
Faixa: -1 a1
Exp
A função exp retorna o valor do
expoente (ex).
Sintaxe: double exp (double x);
Prototype: math.h
Pow
A função pow (power) retorna o valor da potência (xy).
Sintaxe: double pow (double x, double y);
Prototype: math.h
Sqrt
A função sqrt (square root) retorna o valor da raiz quadrada.
Sintaxe: double sqrt (double x);
Prototype: math.h
Log
A função log retorna o valor do logaritmo natural.
Sintaxe: double log (double x);
Prototype: math.h
Atof
A função atof converte string em ponto flutuante.
Sintaxe: double atof (const char *s);
Prototype: math.h e stdlib.h
Atoi
A função atoi converte uma string
em inteiro.
Sintaxe: int atoi (const char *s);
Prototype: stdlib.h
Atol
A função atol converte uma string em inteiro longo.
Sintaxe: long int atol (const char *s);
Prototype: stdlib.h
Log10
A função log10 retorna o logaritmo na base 10.
Sintaxe: double log10 (double x);
Prototype: math.h
Tan
A função tan retorna o valor da tangente. A variável x deve estar em
radianos.
Sintaxe: double tan (double x);
Prototype: math.h
Max
A função max retorna o maior valor entre dois valores.
Sintaxe: int max (int a, int b);
Prototype: stdlib.h
Min
A função min retorna o menor valor entre dois valores.
Sintaxe: int min (int a, int b);
Prototype: stdlib.h
Rand
A função rand retorna um número aleatário entre 0 até 32767.
Sintaxe: int rand (void);
Prototype: stdlib.h
Faixa: 0 a 32767
Random
A função random retorna um número aleatório entre 0 até (limite – 1).
Sintaxe: int random (int limite);
Prototype: stdlib.h
Faixa: 0 a (limite - 1)
Randomize
A função randomize inicializa a geração de números aleatórios.
Sintaxe: void randomize (void);
Prototype: stdlib.h
System
A função system executa comandos e arquivos .COM e .EXE do sistema operacional.
Sintaxe: int system (const char *comando);
Prototype: process.h e stdlib.h
Retorna: 0 (ok) e -1 (erro)
Exemplos: system ("dir");
system ("sk");
system ("dir *.c");