Q1:
if I want to make this char word[32] = "Backward" to be global
how do i initialize the "Backward"?
by doing LDX and STX??

Q2:
in a switch statement in C++, it is often to see
case 0: case 1: cout<<"something"; break;
how do u make this in assembly without making two separate symbols??
the jump table need both case in it for sure.

Q1: Assuming your using MASM

PUBLIC   Str1

             .const
    Str1     db     'Backward', 0

Then in all other modules you would use

extern   Str1:DWORD

so the linker will resolve the global context

Q2: Eventhough some assembers have "switch" macros, there isn't a switch statement in assembly. It is accomplished by testing and branching accordingly.

Str2     db     'something',0

    cmp    al, 1
    ja    @F
    push  offset Str2
    call  _printf
@@:

These examples are incomplete and meant only to convey a concept

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.