Skip to content

Instantly share code, notes, and snippets.

View ABeltramo's full-sized avatar

ABeltramo

View GitHub Profile
@ABeltramo
ABeltramo / gist:7dcc61286dda97177e1e
Last active August 29, 2015 14:19
CercaLeSomme
//
// main.cpp
// CercaLeSomme
//
// Created by Ale on 12/04/15.
// Copyright (c) 2015 ABeltramo. All rights reserved.
//
#include <iostream>
#include <vector>
@ABeltramo
ABeltramo / gist:1d914221d6c9932d46ba
Created March 23, 2015 13:58
C++ vector[ vector [ ] ]
//
// main.cpp
//
// Created by Ale on 23/03/15.
// Copyright (c) 2015 ABeltramo. All rights reserved.
//
#include <iostream>
#include <vector>
char *duplica(char *input) {
size_t len = strlen(input);
//Alloco un nuovo buffer
char *buffer = (char*) malloc(len+1);
if (buffer) {
memcpy(buffer, input, len);
buffer[len] = '\0'; //chiudo la stringa
}