This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdarg.h> | |
#include <stddef.h> | |
#include <setjmp.h> | |
#include <cmocka.h> | |
static void db_connection(void **state) | |
{ | |
(void) state; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int *x() | |
{ | |
int* a = malloc(sizeof(int)); | |
*a = 19; | |
return a; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
#include <stdio.h> | |
int main() | |
{ | |
if(access("a.sh", F_OK) != -1) | |
{ | |
printf("Exists!\n"); | |
} | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//gcc dict.c `pkg-config --libs --cflags glib-2.0` | |
#include <glib.h> | |
#include <stdio.h> | |
int main() | |
{ | |
GHashTable* hash = g_hash_table_new(g_str_hash, g_str_equal); | |
g_hash_table_insert(hash, "name", "Mort"); | |
g_hash_table_insert(hash, "email", "hello@localhost"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <pwd.h> | |
#include <grp.h> | |
#include <stdlib.h> | |
int main(int argc, char *argv[]) | |
{ | |
struct passwd *pwd; | |
struct group *grp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
char b[255]; | |
FILE *f; | |
f = tmpfile(); | |
fputs("hello mr dj", f); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
char *r = getenv("JAVA_HOME"); | |
printf("java home: %s\n", r); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <dirent.h> | |
#include <sys/types.h> | |
int main() | |
{ | |
struct dirent *entry; | |
DIR *dir; | |
dir = opendir("/home/user1/"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//compile: gcc a.c -lmemcached | |
#include <libmemcached/memcached.h> | |
#include <stdio.h> | |
#include <string.h> | |
int main() | |
{ | |
memcached_server_st *servers = NULL; | |
memcached_st *memc; | |
memcached_return rc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
void action(char *a, char *b) __attribute__((nonnull(2))); | |
void action(char *a, char *b) { | |
if (a != NULL) { | |
printf("%s\n", a); | |
} |
NewerOlder