-
-
Save leehambley/132db7594974e328dc7a to your computer and use it in GitHub Desktop.
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> | |
struct session_t { | |
int port; | |
char* host; | |
}; | |
typedef struct session_t *SESSION; | |
void setup(SESSION s); | |
void print(SESSION s); | |
void teardown(SESSION s); | |
int main() { | |
SESSION s = (SESSION) malloc(sizeof(SESSION)); | |
setup(s); | |
print(s); | |
teardown(s); | |
return EXIT_SUCCESS; | |
} | |
void setup(SESSION s) { | |
// s->port = 1024; | |
// s->host = "example.org"; | |
} | |
void print(SESSION s) { | |
sprintf("%s:%d\n", s->host, s->port); | |
} | |
void teardown(SESSION s) { | |
free(s); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment