This is my second day programming and I stumbled upon a fairly hard to understand code. Here it is
Code:
#include <iostream.h>
int add (int x, int y)
{
cout << "In Add(), recieved " << x << "and" << y << "\n";
return (x*y);
}
int main()
{
cout << "Im in main()!\n";
int a, b, c;
cout << "Enter two numbers: \n";
cin >> a;
cin >> b;
cout << "\nCalling Add()\n";
c=add(a,b);
cout << "\nBack in Main().\n";
cout << "c was set to: " << c;
cout << "\nExiting...\n\n\n\n";
return 0;
}
Can someone try to explain what this code does in steps? and what is int a, b, c; is that a function or a variable?
Thanks
*edit* BY the way whats the difference between a variable and a function?