Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
int main() {
int inc = 0, dec = 0;
// incrementing a number
printf("inc = %d\n", inc);
inc++;
printf("inc (po inc++ operacijos) = %d\n", inc);
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
typedef int bool;
#define true 1
#define false 0
typedef struct{
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
typedef int bool;
#define true 1
#define false 0
typedef struct{
@morganwilde
morganwilde / ViewControllerStudentsList.m
Last active December 29, 2015 16:09
UITableView with ALAssets
@interface ViewControllerStudentsList ()
@property (strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (strong, nonatomic) UIManagedDocument *document;
@property (nonatomic) NSInteger studentCount;
@property (strong, nonatomic) NSMutableArray *studentList;
@property (strong, nonatomic) NSMutableDictionary *studentPortraits;
@end
#include <stdio.h>
#include <stdlib.h>
#define NROWS 10
#define NCOLS 7
float col_ave(int x[NROWS][NCOLS], int col) {
float average;
int i, total = 0;
for (i = 0; i < NROWS; i++) {
int *first, // Allocates a pointer to int
a; // Allocates an int
for ( a = 0; // Initializes a to 0
a < 10;
a++ // Increments a value by 1
) {
first[a] = 5;
}
@morganwilde
morganwilde / data.c
Last active August 29, 2015 13:56 — forked from Kablys/data
int data[4], // Allocates an array of type int with 4 elements
i; // Allocates an int
for(i = -8; // Initializes i to -8
i < 10;
i++) // Increments i by 1
printf("%d\n", data[i]);// This will generate an error when i is in [-8, 0)u(3, 9]
// This ^ will iterate over the following values
// -8
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
unsigned intToBinaryInt(unsigned k, int *components, int counter) {
// k - current binary component
// components - collection of all the components
// counter - tracks how many components are there
if (k == 0) {
components[counter] = k;
#include <limits.h>
#include <stdio.h>
int main(void) {
int value = -1;
printf("UINT_MAX: %u\n", UINT_MAX);
printf("value: %d\n", value);
#include <stdlib.h>
#include <stdio.h>
struct Point {
int x;
int y;
int z;
};
struct Segment {