0
possible to pass in arguments of different data types (see below)
it this doable? I keep getting an error when I've tried to combine arguments of different data types in the same function. void printSomething(int x, float x) { cout << "prints an integer and a float << endl; } int main() { int a=5; float b=10.5; printnumber(a,b); }
2 Réponses
+ 2
if you are going in that much only you are doing wrong
1.function name while calling is different.
2.return 0 at end.
3. use appropriate header files
4. user separate identifiers for variables in function prototyping.
+ 2
#include<iostream>
void printSomething(int x, float y)
{
cout << "prints an integer and a float << endl;
}
int main()
{
int a=5;
float b=10.5;
printSomething(a,b);
return 0;
}