Skip to content

Instantly share code, notes, and snippets.

@nenodias
Created March 9, 2017 11:53
Show Gist options
  • Select an option

  • Save nenodias/1b3446b3d017122a629468f00d7a11c9 to your computer and use it in GitHub Desktop.

Select an option

Save nenodias/1b3446b3d017122a629468f00d7a11c9 to your computer and use it in GitHub Desktop.
Teste Cpp
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <malloc.h>
using namespace std;
struct Pessoa{
char *nome;
};
int main(){
struct Pessoa p;
p.nome = (char *) malloc(sizeof(char) * 100 ); // Allocando Memória para a string
strcpy(p.nome, "Neno");// Copiando a string
cout << "Olá Mundo " << p.nome << "!!!" << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment