<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vishal Ahirwar</title>
    <description>The latest articles on DEV Community by Vishal Ahirwar (@vishal-ahirwar).</description>
    <link>https://dev.to/vishal-ahirwar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1065418%2F667deb18-e672-420d-8343-a77884c79572.png</url>
      <title>DEV Community: Vishal Ahirwar</title>
      <link>https://dev.to/vishal-ahirwar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vishal-ahirwar"/>
    <language>en</language>
    <item>
      <title>Can You Guess the output?? ;)</title>
      <dc:creator>Vishal Ahirwar</dc:creator>
      <pubDate>Sat, 15 Apr 2023 07:21:55 +0000</pubDate>
      <link>https://dev.to/vishal-ahirwar/can-you-guess-the-output--531k</link>
      <guid>https://dev.to/vishal-ahirwar/can-you-guess-the-output--531k</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;
#include &amp;lt;signal.h&amp;gt;
#define m_sig signal(SIGSEGV, sig_memory);
void sig_memory(int code)
{
    std::cout &amp;lt;&amp;lt; "something went wrong!\n";
    exit(0);
};

class Test
{
private:
    Test();
    int data;

public:
    Test(const int &amp;amp;value) : data(value){};
    int get_data() const { return this-&amp;gt;data; };
    void set_data(const int &amp;amp;value);
};
void Test::set_data(const int &amp;amp;value)
{
    this-&amp;gt;data = value;
};
#define ONE
template &amp;lt;typename T&amp;gt;
void print_pointer(const T *const p)
{
    if (p == nullptr)
    {
         std::cout &amp;lt;&amp;lt; "you are passing null pointer to argument!\n";
         return;
     };
     std::cout &amp;lt;&amp;lt; *p &amp;lt;&amp;lt; "\n";
}
int main()
{
    m_sig

#ifndef ONE
        Test test1 = 45;
#else
        Test test1(90);
#endif
    std::cout &amp;lt;&amp;lt; test1.get_data() &amp;lt;&amp;lt; '\n';
    int *const ptr = 0;
    *ptr = 56;
    print_pointer(ptr);
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>cpp</category>
      <category>programming</category>
      <category>discuss</category>
      <category>codenewbie</category>
    </item>
  </channel>
</rss>
