Jump to content
Tuts 4 You

read char from int string


novanakal

Recommended Posts

Posted (edited)

hii all...

iam new here,. i still learn for c++

i have some question.

how bout this, i have 1 structure

{
i32 Index;
i32 Total_Character;
str[len=Total_Character] "Text";
}

how to make some cpp header for that structure

i make one


{
int Index;
int Total_Character;
char Text[Total_Character];
};

but still error when compiling

thanks before

Edited by novanakal
Posted

struct YourStructName
{
int Index;
int Total_Character;
char *yourString;
}

With this way you will need to alloc some memory on runtime depending on the size of the string ( you could also use a default size like 255 or something else - would be char yourString[255] then ). To alloc memory you can use malloc or the new operator.

But donĀ“t forget to free it later ;).

~Zer0Flag

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...