Skip to content

Commit 482cc36

Browse files
authored
Merge pull request mouredev#7768 from 04khaos/soluciones
#00 - C
2 parents 05b2f70 + cf92464 commit 482cc36

File tree

1 file changed

+37
-0
lines changed
  • Roadmap/00 - SINTAXIS, VARIABLES, TIPOS DE DATOS Y HOLA MUNDO/c

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Página: https://en.cppreference.com/w/c
2+
3+
// Comentario en una línea.
4+
5+
/*
6+
Comentario de varias líneas.
7+
Aquí puedes añadir información...
8+
:p
9+
*/
10+
11+
#include <stdio.h>
12+
#include <stdbool.h> // Para usar booleanos en C
13+
14+
// Constante con '#define'
15+
#define PI 3.14159
16+
17+
// Constante con 'const'
18+
const int MAX_USERS = 100;
19+
20+
float radio = PI; // Variable global usando '#define'
21+
22+
int main(void)
23+
{
24+
int usuarios_actuales = MAX_USERS - 10; // Variable local usando 'const'
25+
26+
// Datatypes (Sistemas de 32 y 64 bits)
27+
char a = 'C'; // 1 byte | Range: -128 a 127 (modern systems)
28+
short b = -15; // 2 bytes | Range: -32,768 a 32,767
29+
int c = 1024; // 4 bytes | Range: -2,147,483,648 a 2,147,483,647
30+
unsigned int d = 128; // 4 bytes | Range: 0 a 4,294,967,295
31+
long e = 123456; // 4 bytes (32-bit) / 8 bytes (64-bit)
32+
float f = 15.678; // 4 bytes | ~6-7 dígitos de precisión
33+
double g = 123123.123123; // 8 bytes | ~15-16 dígitos de precisión
34+
bool h = true; // 1 byte | Values: true (1) o false (0)
35+
36+
printf("¡Hola, %c!\n", a); // Imprime "¡Hola, C!" usando el valor de la variable 'a' (char)
37+
}

0 commit comments

Comments
 (0)