Code Monkey home page Code Monkey logo

c's Introduction

void * is known as "pointer to void type", meaning variables defined as such are pointers to data of an unspecified type, making it similar to var in C#.

C++

Variables

Braced initializer

int apples {15};

A braced initializer refers to placing the initial value of a variable in braces. This is a novel style of initialization introduced in C++11. Its main advantage is that it will raise a compile-time error if the compiler has to perform a narrowing conversion of the value to match the declared type.

Older but equally valid ways of initializing variables:

int oranges = 12;
int kiwis(13); // "functional notation"

Zero initialization refers to initializing a variable with empty braces. It works for any fundamental type, and numeric types initialize to zero.

int grapes {}; // 0

Literals

Since C++14, you can separate digits in a long integer with a single quote to make it more readable.

int num {12'345}; // 12,345

Hexadecimal literals are prefixed with "0x" and octals with "0":

int hex {0xabcdef};
int oct {0567};

c's People

Contributors

jasper-zanjani avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.