CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2017
    Posts
    2

    Question Understanding variables in C.

    Hi, I'm completely new to the world of programming, and I like to do a lot of C style syntax language, and I want know what most of these variables mean.
    here's an example of some code:

    Code:
    Function_Counter
    
        if ( ( GetAttackCommandId == 25 ) && ( GetAttackId == 103 ) ) {
    
            return
    
        }
    
        if ( #( SV_FunctionEnemy[HP] <$ 50000L ) ) {
    
            if ( ( ( !VAR_GlobUInt8_43 ) && ( GetAttackCommandId != 1 ) ) && ( GetAttackCommandId != 14 ) ) {
    
                set #( SV_Target = GetAttacker )
    
                if ( #( NotMatching(SV_PlayerTeam[STATUS_CURRENT_A], 4355) & SV_Target ) ) {
    
                    set VAR_GlobUInt8_43 = 1
    
                    Attack( 14 )
    
                    return
    
                }
    
            }
    
        }
    
        if ( #( SV_FunctionEnemy[HP] <$ 40000L ) ) {
    
            if ( ( ( !VAR_GlobUInt8_44 ) && ( GetAttackCommandId != 1 ) ) && ( GetAttackCommandId != 14 ) ) {
    
                set #( SV_Target = GetAttacker )
    
                if ( #( NotMatching(SV_PlayerTeam[STATUS_CURRENT_A], 4355) & SV_Target ) ) {
    
                    set VAR_GlobUInt8_44 = 1
    
                    Attack( 14 )
    
                    return
    
                }
    
            }
    
        }
    
        set VAR_GlobUInt16_41 = ( FirstOf(SV_FunctionEnemy[HP]) / 10000 )
    
        if ( GetRandom % ( VAR_GlobUInt16_41 + 1 ) ) {
    
            return
    
        }
    
        set #( SV_Target = SV_FunctionEnemy )
    
        Attack( 9 )
    
        return


    I want to know what the symbols & and % also mean and what they symbolize, point to, etc.
    any help is greatly appreciated.

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: Understanding variables in C.

    What language is this - as it isn't c?
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #3
    Join Date
    May 2017
    Posts
    2

    Re: Understanding variables in C.

    It's C+

  4. #4
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: Understanding variables in C.

    c+ has nothing really to do with c (or c++). Its a variant of ABCL based upon c rather than Lisp. See https://en.wikipedia.org/wiki/Actor-...rrent_Language

    [thread moved as not c based]
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  5. #5
    Join Date
    Feb 2017
    Posts
    677

    Re: Understanding variables in C.

    Although interesting, the C+ language doesn't seem to be very much in use today. As first language I suggest you go for something more current. And when you have decided on one, you really need to use some introductory text to learn the basics. Forums are not well suited for questions that require a whole lecture as answer.

    Note that variable names are not part of programming languages. They are invented by programmers during programming. So to "understand" variables one must ask the programmer or guess his/her intentions. Reserved keywords on the other hand are part of languages (and may therefore not be used as variable names since that would be confusing).

    Here's a site that ranks languages after "popularity",

    https://www.tiobe.com/tiobe-index/

    To select a first language I would have a close look at Java, C++ and C#. Then I would check out Python, Swift and Go. All are general purpose languages but still differ in character. Some are (more or less) affiliated with a specific company but that shouldn't matter much unless you are especially interested in a certain company.
    Last edited by wolle; May 19th, 2017 at 02:46 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured