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
// https://medium.com/@FreeDev/modularizando-c%C3%B3digo-em-c-784dc52d1c34 | |
#include <stdio.h> | |
#include "module.h" | |
int main(void) | |
{ | |
printf("Valor: %d\n", sum(3, 7)); | |
return 0; |
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
/******************** | |
* Exemplo básico de uso de sockets no Linux. | |
* Por Luiz Felipe - https://github.com/Silva97 | |
* | |
* Link do vídeo: https://youtu.be/GaxjJvMnz-I | |
********************/ | |
#include <stdio.h> | |
#include <unistd.h> |
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 "target.h" | |
OS_LINUX(char *os, void) | |
{ | |
return "Linux"; | |
} | |
OS_WINDOWS(char *os, void) | |
{ |
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 <string.h> | |
#define CATCH(name) \ | |
if (0) \ | |
_catch_##name: | |
#define FAIL(name) goto _catch_##name | |
#define FAIL_IF(expr, name) \ |
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
/******************** | |
* Exemplo por Luiz Felipe. | |
* https://github.com/Silva97 | |
********************/ | |
#include <stdio.h> | |
#include <string.h> | |
#include <unistd.h> // Para usar chdir() | |
#include <dirent.h> |
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 "printstruct.h" | |
typedef struct | |
{ | |
int a; | |
char *b; | |
char c; | |
long int d; | |
long long int e; |
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
// See how it's works using: gcc -S get-function-size.c -o get-function-size.s | |
// To manually check function size: objdump -d get-function-size | |
#include <stdio.h> | |
#define DECLARE_FUNCSIZE(funcname) \ | |
extern unsigned int funcname##_funcsize; \ | |
asm(#funcname "_funcsize: .long . - " #funcname "\n\t") | |
#define FUNCSIZE(funcname) \ | |
funcname##_funcsize |
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
/******************** | |
* Exemplo básico de uso de sockets no Linux. | |
* Por Luiz Felipe - https://github.com/Silva97 | |
* | |
* Link do vídeo: https://youtu.be/GaxjJvMnz-I | |
********************/ | |
#include <stdio.h> | |
#include <winsock2.h> |
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
// Just an exercise example. | |
#include <stdio.h> | |
#include <stdlib.h> | |
void crep(int character, unsigned int number); | |
int main(int argc, char **argv) | |
{ | |
if (argc < 2) | |
{ |
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(void) | |
{ | |
int x = 5; | |
float y = 5.0f; | |
int *x_ptr = &x; | |
int *y_ptr = (int *)&y; |