Pointers & Function Overloading

  • Sonar Systems admin
    Likes 0

    Problem Description

    Code example for Pointers and Function Overloading

    Solution Description
    #include <iostream>
    
    void Func1(int x)
    {
    	std::cout << x << std::endl;
    }
    
    void Func1(int x, int y)
    {
    	std::cout << x * y << std::endl;
    }
    
    int main()
    {
    	int var1 = 5;
    	int *var2 = &var1;
    
    	std::cout << *var2 << std::endl;
    
    	var1 = 99;
    
    	std::cout << *var2 << std::endl;
    
    	*var2 = 56;
    
    	std::cout << var1 << std::endl;
    
    	Func1(67, 10);
    
    	system("pause");
    
    	return EXIT_SUCCESS;
    }

     

Login to reply