0

Why can't we call function like this

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int res = Area(int h=5, int w= 8); Console.WriteLine(res); Console.Read(); } static int Area(int h, int w) { return h * w; } } }

13th May 2019, 12:22 PM
Shaik Shabbeer
Shaik Shabbeer - avatar
1 Antwort
0
Parameters don't need to be declared, you can just write: int res = Area( 5, 8 ); or you declare them first: int h = 5, w = 8; int res = Area ( h, w );
13th May 2019, 3:53 PM
Felix Henke
Felix Henke - avatar