Skip to content

Instantly share code, notes, and snippets.

@jameswritescode
Last active August 29, 2015 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jameswritescode/8713110 to your computer and use it in GitHub Desktop.
Save jameswritescode/8713110 to your computer and use it in GitHub Desktop.
#include <stdio.h>
typedef struct {
char *name;
int age;
} Person;
void person_info(Person person)
{
printf("%s, %i\n", person.name, person.age);
}
int main(int argc, const char *argv[])
{
Person person = {"James Newton", 21};
person_info(person);
return 0;
}
class Person
attr_accessor :name, :age
def initialize(name, age)
self.name = name
self.age = age
end
def info
puts "#{self.name}, #{self.age}"
end
end
person = Person.new('James Newton', 21)
person.info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment