Skip to content

Commit

Permalink
Added a new example for debug information
Browse files Browse the repository at this point in the history
  • Loading branch information
fzakaria committed Feb 2, 2024
1 parent 315be4c commit 98b485e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/debug-information/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Variables
CC = g++
CFLAGS = -Wall -g
TARGET = exe
SRC = debug.cc

# Default rule
all: $(TARGET)

$(TARGET): $(SRC)
$(CC) $(CFLAGS) -o $@ $<

.PHONY: clean
clean:
rm -f $(TARGET)
19 changes: 19 additions & 0 deletions examples/debug-information/debug.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <iostream>

typedef struct Input {
int x;
int y;
} Input;

int product(Input input) {
int result = input.x * input.y;
return result;
}

int main() {
int a = 5;
int b = 3;
int result = product({a, b});
std::cout << "The product is: " << result << std::endl;
return 0;
}

0 comments on commit 98b485e

Please sign in to comment.