MELDAW Posted January 2, 2023 Report Posted January 2, 2023 Hello, I was trying to create a struct table in C, i tried in my C complier and it worked, but when i complie in unilogic i get errors, is there a syntaxe i should use in unilogic?
Rivka Posted January 2, 2023 Report Posted January 2, 2023 Hello, Do you mean an array of structs? Can you post the exact syntax you are using and the error given by UniLogic compiler? Thanks
MELDAW Posted January 2, 2023 Author Report Posted January 2, 2023 Yes, I will send you screen captures
Rivka Posted January 3, 2023 Report Posted January 3, 2023 Hello, The syntax is not correct. If you want to use the Var_Struct_Student variable, don't specify again the type. The compiler understands that you want to redefine the type Student. I don't know what you intend to do with the variable Var_Struct_Student, but this is an exampple of a correct way to use it: int i = 0; Var_Struct_Student[i].rollNumber = 5; (note: there is another issue here, that you use i before you assign a value to it.) I would suggest you to get a more solid C background, before using C functions, as debugging them could be more painful than ladder. C functions are of the type "you know what you are doing? So go for it!" Hope that helped Rivka 1
MELDAW Posted January 3, 2023 Author Report Posted January 3, 2023 Yes thank you for reply, it helped. And yes i know that was i didn't assign a value for i, since in memory they can give an random number for i so i need to asign it, but it was only rapid thing to show you my problem in struct. Thank you for your help.
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