Enviado em 27/12/2014 - 13:15h
Ola pessoal..
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
struct Test{
char *nome;
int x;
int y;
};
int main(){
struct Test t01;
t01.nome="daniell";
t01.x=5;
t01.y=9;
char c = t01.x + '0';
char d = t01.y + '0';
unsigned int tam = strlen(t01.nome)+sizeof(t01.x)+sizeof(t01.y)+1;
printf("tam: %u\n",tam);
char test[tam];
printf("len test: %zu\n",sizeof(test));
test[strlen(test)] = c;
test[strlen(test)] = d;
strcat(test,t01.nome);
printf("%s\n",test);
printf("%d\n",strlen(test));
return 0;
}