Your name or email adress:
Do you already have an account?
Forgot your password?
  • Log in or Sign up

    Results 1 to 4 of 4
    1. #1
      Status
      Offline
      Achievements:
      Tagger First Class31 days registered25000 Experience Points
      Awards:
      Frequent Poster
      CoderX's Avatar
      Senior Member
      Join Date
      Oct 2016
      Posts
      6,557
      Points
      44,533
      Level
      100
      Points: 44,533, Level: 100
      Points: 44,533, Level: 100
      Level completed: 0%,
      Required for next Level: 0
      Level completed: 0%, Required for next Level: 0
      Overall activity: 99.9%
      Overall activity: 99.9%

      C# - Constants and Literals

      The constants refer to fixed values that the program may not alter during its execution. These fixed values are also called literals. Constants can be of any of the basic data types like an integer constant, a floating constant, a character constant, or a string literal. There are also enumeration constants as well.The constants are treated just like regular variables except that their values cannot be modified after their definition.Integer Literals

      An integer literal can be a decimal, or hexadecimal constant. A prefix specifies the base or radix: 0x or 0X for hexadecimal, and there is no prefix id for decimal.An integer literal can also have a suffix that is a combination of U and L, for unsigned and long, respectively. The suffix can be uppercase or lowercase and can be in any order.Here are some examples of integer literals:212 /* Legal */
      215u /* Legal */
      0xFeeL /* Legal */
      Following are other examples of various types of Integer literals:85 /* decimal */
      0x4b /* hexadecimal */
      30 /* int */
      30u /* unsigned int */
      30l /* long */
      30ul /* unsigned long */
      Floating-point Literals

      A floating-point literal has an integer part, a decimal point, a fractional part, and an exponent part. You can represent floating point literals either in decimal form or exponential form.Here are some examples of floating-point literals:3.14159 /* Legal */
      314159E-5L /* Legal */
      510E /* Illegal: incomplete exponent */
      210f /* Illegal: no decimal or exponent */
      .e55 /* Illegal: missing integer or fraction */
      While representing in decimal form, you must include the decimal point, the exponent, or both; and while representing using exponential form you must include the integer part, the fractional part, or both. The signed exponent is introduced by e or E.Character Constants

      Character literals are enclosed in single quotes. For example, 'x' and can be stored in a simple variable of char type. A character literal can be a plain character (such as 'x'), an escape sequence (such as '\t'), or a universal character (such as '\u02C0').There are certain characters in C# when they are preceded by a backslash. They have special meaning and they are used to represent like newline (\n) or tab (\t). Here, is a list of some of such escape sequence codes:
      Escape sequence Meaning
      \\ \ character
      \' ' character
      \" " character
      \? ? character
      \a Alert or bell
      \b Backspace
      \f Form feed
      \n Newline
      \r Carriage return
      \t Horizontal tab
      \v Vertical tab
      \xhh . . . Hexadecimal number of one or more digits
      Following is the example to show few escape sequence characters:using System;
      namespace EscapeChar
      {
      class Program
      {
      static void Main(string[] args)
      {
      Console.WriteLine("Hello\tWorld\n\n");
      Console.ReadLine();
      }
      }
      }
      When the above code is compiled and executed, it produces the following result:Hello World
      String Literals

      String literals or constants are enclosed in double quotes "" or with @"". A string contains characters that are similar to character literals: plain characters, escape sequences, and universal characters.You can break a long line into multiple lines using string literals and separating the parts using whitespaces.Here are some examples of string literals. All the three forms are identical strings."hello, dear"
      "hello, \
      dear"
      "hello, " "d" "ear"
      @"hello dear"
      Defining Constants

      Constants are defined using the const keyword. Syntax for defining a constant is:const <data_type> <constant_name> = value;The following program demonstrates defining and using a constant in your program:using System;
      namespace DeclaringConstants
      {
      class Program
      {
      static void Main(string[] args)
      {
      const double pi = 3.14159;

      // constant declaration
      double r;
      Console.WriteLine("Enter Radius: ");
      r = Convert.ToDouble(Console.ReadLine());
      double areaCircle = pi * r * r;
      Console.WriteLine("Radius: {0}, Area: {1}", r, areaCircle);
      Console.ReadLine();
      }
      }
      }
      When the above code is compiled and executed, it produces the following result:

    2. #2
      Status
      Offline
      Achievements:
      7 days registered100 Experience Points
      d3m's Avatar
      Member
      Join Date
      Dec 2016
      Posts
      52
      Points
      180
      Level
      3
      Points: 180, Level: 3
      Points: 180, Level: 3
      Level completed: 60%,
      Required for next Level: 20
      Level completed: 60%, Required for next Level: 20
      Overall activity: 0%
      Overall activity: 0%
      Thanks man..

    3. #3
      Status
      Offline
      AjayDevgan's Avatar
      Junior Member
      Join Date
      Mar 2017
      Posts
      21
      Points
      45
      Level
      1
      Points: 45, Level: 1
      Points: 45, Level: 1
      Level completed: 90%,
      Required for next Level: 5
      Level completed: 90%, Required for next Level: 5
      Overall activity: 99.0%
      Overall activity: 99.0%
      Notwithstanding its low-level abilities, the dialect was intended to support cross-stage programming. A norms consistent and movably composed C program can be accumulated for a wide assortment of PC stages and working frameworks with few changes to its source code. The dialect has turned out to be accessible on an extensive variety of stages, from implanted microcontrollers to supercomputers. Unix was one of the principal working framework portions actualized in a dialect other than gathering. Prior occasions incorporate the Multics framework which was composed in and Master Control Program for the Burroughs B5000 written in ALGOL in 1961. In around 1977, Ritchie and Stephen C. Johnson rolled out further improvements to the dialect to encourage conveyability of the Unix working framework. Johnson's Portable C Compiler filled in as the reason for a few usage of C on new stages.

    4. #4
      Status
      Offline
      AjayDevgan's Avatar
      Junior Member
      Join Date
      Mar 2017
      Posts
      21
      Points
      45
      Level
      1
      Points: 45, Level: 1
      Points: 45, Level: 1
      Level completed: 90%,
      Required for next Level: 5
      Level completed: 90%, Required for next Level: 5
      Overall activity: 99.0%
      Overall activity: 99.0%
      C was initially created by Dennis Ritchie in the vicinity of 1969 and 1973 at Bell Labs and used to re-actualize the Unix working framework. It has since turned out to be a standout amongst the most broadly utilized programming dialects ever with C compilers from different merchants accessible for the lion's share of existing PC structures and working frameworks. c programming pdf C has been institutionalized by the American National Standards Institute (ANSI) since 1989 (see ANSI C) and consequently by the International Organization for Standardization (ISO).

      Notwithstanding its low-level abilities, the dialect was intended to support cross-stage programming. A norms consistent and movably composed C program can be accumulated for a wide assortment of PC stages and working frameworks with few changes to its source code. The dialect has turned out to be accessible on an extensive variety of stages, from implanted microcontrollers to supercomputers. Unix was one of the principal working framework portions actualized in a dialect other than gathering. Prior occasions incorporate the Multics framework which was composed in and Master Control Program for the Burroughs B5000 written in ALGOL in 1961. In around 1977, Ritchie and Stephen C. Johnson rolled out further improvements to the dialect to encourage conveyability of the Unix working framework. Johnson's Portable C Compiler filled in as the reason for a few usage of C on new stages.

    Tags for this Thread

    Posting Permissions

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

    LeakNinja (LN) Contact Details:
    Main address: 4407 Oakwood Avenue 87937 Paris, France ,
    Tel:( 21 2) 645-8417 , Fax:( 33 1) 645-34517 ,
    E-mail: Webmasters@leakninja.com
    LiZard