Introdução à Linguagem C - pucrs
Introdução à Linguagem C - pucrs
Introdução à Linguagem C - pucrs
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Tipos de Dados<br />
• A divisão se deve basicamente ao<br />
número de bytes reservados para cada<br />
dado.<br />
• Cada tipo de dado possui um intervalo<br />
de valores permitidos.<br />
Tipos Básicos de Dados<br />
• Inteiro <strong>à</strong> int<br />
• Real (ponto flutuante) <strong>à</strong> float<br />
• Caracter <strong>à</strong> char<br />
• Seqüência de caracteres <strong>à</strong> string<br />
Profª. Leticia L. Leite - lleite@inf.<strong>pucrs</strong>.br<br />
Profª. Leticia L. Leite - lleite@inf.<strong>pucrs</strong>.br<br />
Representação dos Tipos Básicos<br />
de Dados<br />
• Integer <strong>à</strong> %d<br />
• Float <strong>à</strong> %f<br />
• Char <strong>à</strong> %c<br />
Observação 1:<br />
• Separador decimal para números em<br />
ponto flutuante é o ponto final ( . ).<br />
• Também pode ser escrito em notação<br />
científica.<br />
Profª. Leticia L. Leite - lleite@inf.<strong>pucrs</strong>.br<br />
Profª. Leticia L. Leite - lleite@inf.<strong>pucrs</strong>.br<br />
Observação 2:<br />
Tipos de Dados x Memória<br />
• Os caracteres são representados entre aspas<br />
simples ( ´ ).<br />
Tipo<br />
Bytes<br />
Escala<br />
• Exemplos:<br />
Char<br />
1<br />
-128 a 127<br />
´Mariana´<br />
´Elvira´<br />
S<br />
t<br />
r<br />
i<br />
n<br />
g<br />
´M´<br />
´A´<br />
c<br />
h<br />
a<br />
r<br />
Int<br />
Float<br />
Double<br />
2<br />
4<br />
8<br />
-32.768 a 32.767<br />
3.4e -38 a 3.4e +38<br />
1.7e -308 a 1.7e +308<br />
Profª. Leticia L. Leite - lleite@inf.<strong>pucrs</strong>.br<br />
Profª. Leticia L. Leite - lleite@inf.<strong>pucrs</strong>.br