#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#define MAX_BUFFER_SIZE 1024
#define SQUARE(x) ((x) * (x))
#define CONCAT(a, b) a ## b
#define STRINGIFY(x) #x
typedef struct Point {
int x;
int y;
struct Point* next;
} Point;
typedef union Data {
int i;
float f;
char str[20];
} Data;
enum Color {
RED,
GREEN,
BLUE = 10
};
static int counter = 0;
const double PI = 3.1415926535;
extern void helper_function(void);
int add(int a, int b);
void print_point(Point p);
int main(int argc, char* argv[]) {
int a = 10;
long b = 20000L;
unsigned int c = 30U;
float f = 1.5f;
double d = 2.5;
char ch = 'A';
char* str = "Hello, World!";
int numbers[5] = {1, 2, 3, 4, 5};
int matrix[2][2] = {{1, 0}, {0, 1}};
int* ptr = &a;
*ptr = 20;
Point* p = (Point*)malloc(sizeof(Point));
if (p == NULL) {
fprintf(stderr, "Memory allocation failed\n");
return 1;
}
p->x = 10;
p->y = 20;
if (a > 5) {
printf("Greater than 5\n");
} else if (a == 5) {
printf("Equal to 5\n");
} else {
printf("Less than 5\n");
}
for (int i = 0; i < 5; i++) {
printf("%d ", i);
}
while (counter < 10) {
counter++;
}
do {
counter--;
} while (counter > 0);
switch (ch) {
case 'A':
printf("Alpha\n");
break;
case 'B':
printf("Bravo\n");
break;
default:
printf("Other\n");
}
int x = 0x0F;
int y = 0xF0;
int z = x & y | (x ^ y) << 1 >> 1;
int not_x = ~x;
bool is_valid = (a > 0) && (b > 0) || !false;
int min = (a < b) ? a : b;
goto cleanup;
cleanup:
free(p);
return 0;
}
int add(int a, int b) {
return a + b;
}
void log_message(const char* format, ...) {
}
[[nodiscard]] int compute(void) {
return 42;
}
_Complex double cplx = 1.0 + 2.0 * _Complex_I;
int hex = 0xFF;
int oct = 0777;
int bin = 0b1010;