title: C++ Initializing Struct Without Pointer
body: <p>I have a struct in C++</p>
  
  <pre><code>typedef struct DIFColor
  {
      uint8_t r;
      uint8_t g;
      uint8_t b;
  
  
  } DIFColor;
  </code></pre>
  
  <p>And am trying to initialize it like this:</p>
  
  <pre><code>DIFColor d = new DIFColor();
  
  d.r = r;
  d.g = g;
  d.b = b;
  </code></pre>
  
  <p>But the compiler complains about not being able to convert a pointer to a regular variable. What pointer? From <a href="https://stackoverflow.com/questions/5914422/proper-way-to-initialize-c-structs" title="this question">this question</a> I thought you could simply create a new struct without having to deal with pointers and dynamic memory allocation with <code>new</code>. Does it have something to do with the fact that I am initializing the struct like one would in C, instead of using a constructor?</p>
  
  <pre><code>error: conversion from 'DIFColor*' to non-scalar type 'DIFColor' requested
  </code></pre>