novanakal Posted October 24, 2012 Posted October 24, 2012 (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 structurei make one{int Index;int Total_Character;char Text[Total_Character];};but still error when compilingthanks before Edited October 24, 2012 by novanakal
Zer0Flag Posted October 24, 2012 Posted October 24, 2012 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now