char buffer[9];strncpy(buffer, "hola com", 9);
#include <cstdio>#include <cstdlib>#include <cstring>int main(){ char buffer[] = "hola com"; // Utiliza malloc si trabajas con C //char* buffer2 = (char*) malloc(sizeof(char) * 9); char* buffer2 = new char[9]; strncpy(buffer2, "hola com", 9); buffer[0]='a'; buffer2[0] = 'a'; //int* a = (int*) malloc(sizeof(int)); int* a = new int(); *a = 123; *a = 245; // Si utilizaste malloc, usa free para liberar //free(buffer2); //free(a); delete buffer2; delete a; return 0;}