Skip to content

Instantly share code, notes, and snippets.

View Gikoskos's full-sized avatar
🔨
Working hard

GK Gikoskos

🔨
Working hard
View GitHub Profile
@Gikoskos
Gikoskos / test.c
Last active August 29, 2015 14:28
no more memory problem in C
#include <unistd.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
char *foo2 ()
{
return "FOO";
}
char *str = "ab xy zx NN", *buf = "xx";
while (strcmp(str, "NN") != 0) {
if (str[0] == buf[0] && str[1] == buf[1]) {
printf("found!\n");
}
str = &str[3];
}