Skip to content

Instantly share code, notes, and snippets.

View pkrll's full-sized avatar
🍎

Ardalan Samimi pkrll

🍎
View GitHub Profile
@pkrll
pkrll / q4.c
Created May 26, 2019 12:03
Question 4
#include <stdlib.h>
int main() {
//!showGraph()
int **x = malloc(sizeof(int*)*2);
int *y = malloc(sizeof(int));
*x = y;
free(y);
@pkrll
pkrll / q3.c
Created May 26, 2019 12:03
Question 3
#include <stdio.h>
void bar(int *y) {
char *msg = "hello, world";
puts(msg); /// P
*y = 84;
}
int foo(int i, int *x) {
int z;
if (i > 1024)
@pkrll
pkrll / q2.c
Created May 26, 2019 12:02
Question 2
int main() {
//!showGraph()
char *a = "Foo";
char b[2] = "42";
char c[2] = "84";
a = c;
a += 2;
return 0;
}
@pkrll
pkrll / q1.c
Created May 26, 2019 12:02
Question 1
#include <stdlib.h>
struct bar {
char *g;
};
struct foo {
struct bar *f;
int *y;
int *z;
import Foundation
class NumberToIndexTransformer: NSValueTransformer {
func decrementNumber(value: AnyObject) -> AnyObject {
if var value = value as? NSNumber {
value = Int(value) - 1
return value
}