Search code examples
cstringgccansi-c

String with number as Variable , Unix C question


I want to use abc1 ,abc2, abc3,abc4,..abc100,as struct variable name. But I don't know how to set this? have no idea.

Can anybody help me out? Thanks indeed.


Solution

  • It sounds like you're looking for an array.

    typedef struct { 
    /* ... */
    } whatever;
    
    whatever abc[100];
    
    abc[0] = xxx;
    abc[3] = yyy;