0

I've got a small question regarding dynamic structure definitions. When declaring a structure definition under ANSI-C, is it possible to use a "string"-variable as a structure identifier like below?

*(a_string_var) = "username";
struct user *(a_string_var); 
3
  • What do you expect this to do? The answer is no, anyway, but what's it supposed to mean? Commented Jul 1, 2012 at 21:03
  • @hobbs I think the intention would be a struct user variable named username. Commented Jul 1, 2012 at 21:11
  • My intention indeed was to create a structure with a variable identifier. To be more specific to create a username starting with the first letter of the firstname, and the full surname. I know i can create an array of structs, but in that case the structure identifier would become something like user[0]. but that's something i've been trying to avoid. Commented Jul 1, 2012 at 22:05

1 Answer 1

2

No, all declarations in C must use static, inline identifiers.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks mate, that's exactly what i wanted to know. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.