What does 'Language Construct' mean?

前端 未结 9 504
鱼传尺愫
鱼传尺愫 2020-12-14 15:17

I am learning C from \'Programming in C\' by Stephen Kochan.

Though the author is careful from the beginning only not to confuse the students with jargon, but occas

相关标签:
9条回答
  • 2020-12-14 15:49

    Wikipedia definition:

    A language construct is a syntactically allowable part of a program that may be formed from one or more lexical tokens in accordance with the rules of a programming language. The term Language Constructs is often used as a synonym for control structure, and should not be confused with a function.

    0 讨论(0)
  • 2020-12-14 15:55

    They are the base units from which the language is built up. They can't be used as a function rollback. They are directly called by the parser. It includes all the syntax, semantics and coding styles of a language. For more clarification you may refer to this question.

    0 讨论(0)
  • 2020-12-14 15:55

    Language constructs according to the GCSE book are basic building block of a programming language. that are

    1. Sequential,     
    2. Selection, if, if/else    
    3. Iteration, while, for  
    
    0 讨论(0)
  • 2020-12-14 15:56

    C is a structural language so while compiling your code everything thing goes statement by statement. Thus it becomes necessary to place your statement properly. This placing i.e. putting your statement correctly is your language construct else there may be syntax error or logical error.

    0 讨论(0)
  • 2020-12-14 15:57

    A language construct is a piece of language syntax. For example, the following is a language construct in C that lets you control the flow of a program:

    if ( condition ) {
      /* when condition is true */
    } else {
      /* when condition is false */
    }
    

    They usually use the term language construct because these are parts of most programming languages, but may be written differently, depending on the language. For example, a similar language construct in bourne shell would be:

    if COMMAND; then
      # when command returns 0
    else
      # when command returns anything else
    fi
    

    The function of this construct is the same, however, the way it's written is a bit different.

    Hope this helps. If you need more detail, you may want to do a bit more research. As one of the comments suggests, Wikipedia may be helpful.

    0 讨论(0)
  • 2020-12-14 16:01

    Let say you want to create a class containing methods and properties, so:

    Construct is an architecture of a class you are about to create. The architecture of the class consists of methods and properties created by you by using predefined utilities (such as: 'if', 'else', 'switch', 'break', etc)

    That's my take on construct.

    0 讨论(0)
提交回复
热议问题