Skip to content

Instantly share code, notes, and snippets.

View preslavmihaylov's full-sized avatar

Preslav Mihaylov preslavmihaylov

View GitHub Profile
#include <stdio.h>
#define SUM(x, y) (x + y)
int main(int argc, char *argv[])
{
int a = 5;
int b = 10;
int sum = SUM(a, b);
printf("%d\n", sum);
/* Preprocessed code omitted */
int main(int argc, char *argv[])
{
int a = 5;
int b = 10;
int sum = (a + b);
printf("%d\n", sum);
}
#include <stdio.h>
void bar()
{
int var = 10;
printf("var in bar: %d\n", var);
}
void foo()
{
#include <stdio.h>
#define bar() \
int var = 10;\
printf("var in bar: %d\n", var)
void foo()
{
int var = 5;
printf("var in foo: %d\n", var);
#include <iostream>
using namespace std;
void printError(int errorCode, string msg = "No message")
{
cerr << "Error code: " << errorCode << " (" << msg << ")\n";
}
int main(int argc, char *argv[])
#include <stdio.h>
#define printErrord(errorCode) printError(errorCode, "No message")
void printError(int errorCode, char *msg)
{
printf("Error code: %d (%s)\n", errorCode, msg);
}
int main(int argc, char *argv[])
#ifndef MACROS_IN_C_H
#define MACROS_IN_C_H
/* Function prototypes */
#endif // MACROS_IN_C_H
@preslavmihaylov
preslavmihaylov / .bashrc
Created May 1, 2018 09:22
start tmux by default when you open a new terminal window
if [[ ! $TERM =~ screen ]]; then
exec tmux
fi
@preslavmihaylov
preslavmihaylov / pathogen.vim installation
Created June 8, 2018 12:55
Simple install of pathogen vim plugin
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
git clone https://github.com/haya14busa/incsearch.vim ~/.vim/bundle/incsearch.vim