+ 2
How defMethod is working here?
#include<bits/stdc++.h> #define defMethod(i)(i*i) using namespace std; int main() { int a,b=5; a=defMethod(b+5); cout<<a; return 0; } Output: 35
3 Réponses
+ 3
#define replaces text when compiled. So,
defMethod(b + 5);
will be replaced with
(b + 5 * b + 5);
If you calculate (5 + 5 * 5 + 5), it will be 35. The expression inside the parentheses isn't evaluated.
+ 1
Well, of course it is a sequence, where
an = 6n + 5
(or just a1 = 11; d = 6)
That's just common sense
0
Airree I have tried it by changing the parameter while calling with b=1,2,3,4,5 the output seems like a series.
Yeah you told is absolutely correct.
Thanks for helping.☺️☺️