- php
- python
- pip
#58595B,#464547,#FF681D,#F8F8F8,#62B1BD,#FFFFFF,#A3D55F,#FF681D |
#include <stdio.h> | |
typedef struct { | |
char *name; | |
int age; | |
} Person; | |
void person_info(Person person) | |
{ | |
printf("%s, %i\n", person.name, person.age); |
2013-11-07 20:40:24 --> anon321 (Mibbit@SplitNET-1qt5us.torservers.net) has joined #splitnet | |
2013-11-07 20:40:46 anon321 who wants to see splitnet split | |
2013-11-07 20:43:16 tyler how much split could a split net net if a split net did net split | |
2013-11-07 20:43:23 <-- Harrison (Harrison@SplitNET-h5q.4sf.188.192.IP) has quit (Connection closed) | |
2013-11-07 20:45:20 <-- VanKrause (lolol@SplitNET-t56blg.ca.charter.com) has quit (Ping timeout: 121 seconds) | |
2013-11-07 20:46:35 --> Harrison (Harrison@SplitNET-h5q.4sf.188.192.IP) has joined #splitnet | |
2013-11-07 20:46:47 anon321 :) | |
2013-11-07 21:02:38 --> VanKrause (lolol@SplitNET-t56blg.ca.charter.com) has joined #splitnet | |
2013-11-07 21:39:27 <-- anon321 (Mibbit@SplitNET-1qt5us.torservers.net) has left #splitnet | |
2013-11-08 01:02:37 newton lol |
#include <stdio.h> | |
typedef struct { | |
char *eyes; | |
char *hair; | |
} Colors; | |
typedef struct { | |
char *name; | |
char *age; |
#include <stdio.h> | |
int main(int argc, const char *argv[]) | |
{ | |
char *people[3] = {"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii", "Robert Babcock", "Zach Smith"}; | |
for (int i = 0; i < sizeof(people) / sizeof(people[0]); i++) { | |
printf("Size of people[%i]: %lu\n", i, sizeof(people[i])); | |
printf("Name: %s\n", people[i]); | |
} |
#include "person.h" | |
int main(int argc, const char *argv[]) | |
{ | |
person_t james = {"James", "Newton", 21}; | |
person_print(james); | |
return 0; | |
} |
This is the third part of my [Learning code by comparison][1] series of learning C with explanations in Ruby.
It's always normal when writing a library, application, or other things in Ruby to use multiple files. It's common to do this with C too, but since we compile it's not as simple as our typical require
.
To start off our Ruby example we'll create a Person
module with common methods we'll want to include in our James
class. This would allow us to give James
extra methods that are unique to that class.
module Person
def full_name
"#{@first_name} #{@last_name}"
I hereby claim:
To claim this, I am signing this object:
require 'cocaine' |