C++ interview question:

How do you write a template for a function add that takes 2 params, if integers, returns the sum but if strings returns a concatenated string.

Tricky part: for an integer, one param is INT_MAX. What would be a proper return type so that the output is not something absurd as -2147483549?

Note: auto doesn't solve this.

Posting as :
works at
You are currently posting as works at

Check if either of one parameter is INT_MAX. If so then return that integer.

Then check below conditions before addition
If a and b are two integers! Then we can check like
a > INT_MAX - b
return INT_MAX

b> INT_MAX - a
return INT_MAX

Not sure if I am making sense here😐

Understood but the requirement is to promote the datatype if the result is beyond the limit. For example here the output should be 75000 but is not supported because of the limit of uint16.

Post Photo

Related Posts

Hello, anyone here with Mastercard working on software development team for fraud prevention. Got a interview coming up, have some doubts. Could really use some help. I'm new to this application,. Not sure how DMs work:( Thanks in advance!


Any thoughts on Redesign health? Senior manager / director level, focus on broader strategy / corp dev and interested in type of work, culture, comp, WLB and interview process


Agency producer here. I have an interview with an in-house agency tomorrow and I’m trying to prep myself/anticipate questions that the Exec Producer will ask. Any sample questions you guys can think of? I feel so rusty, it’s been over 5 years since I’ve interviewed anywhere. Very much appreciated!

Thinking about applying to the human capital services area of PEPI. Can anyone give me any insight into isn't what it's like? What is the hierarchy structure? I'd be applying as a senior consultant from Deloitte doing the same kind of work. What level do you think I should apply for and how much can I expect in base/bonus pay? If you're not in the human capital area can you still answer these questions so I can get some insight? Thanks!


Interviewing for a digital acq marketing operations compliance role at Citi. The role would be under digital marketing op within US personal banking. Anyone have insights into the culture + WLB here?


Hi fishes, I am an immediate joiner and have 12 yoe.. undergoing the interview process for technology manager.
Wht is the ctc I can negotiate ??


Anyone work in the area of Nurse Practice Development? Nurse Educator. On my last interview and was told there is a cap on salary. Want to negotiate. In Texas.


Can I get a referral for Morgan Stanley Technical Summer Analyst internship. I'm applying through their own portal, and really wish to atleast appear for a test and that would happen only with a referral. I'm here attacking my resume. Morgan Stanley JPMorgan Chase

Post Photo

GC timeline update (EB1C, India)
PD: Jan 2018
RD: July-end 2020
Biometrics: Dec 2020
EAD/AP: Dec 2020
Interview waived
AOS approved: May 2021


Currently interviewing for a remote account manager position with USI Insurance in NC. I have over 20 years experience in personal lines as an agent. Can anyone provide insight as to the average pay for this position?


Hi folks, what rank/ grade shall I expect for a 11+ exp. My interview is scheduled for next week.

I am already having an offer of 36 Lakh fixed from wells fargo.

I am a generalist/project manager.


Happy Friday! 🐠 does anyone work at iHeartMedia? What’s it like? I have an interview coming up and Glassdoor reviews don’t look so good ....


Received verbal offer from the recruiter after interviews. Recruiter says takes 5-10 days to get the “business case” approved. It’s been 8 days without updates. Is this normal?


Hey all! I am currently a student in my final year of complete a Computer Science undergrad degree and am currently looking applying to remote college graduate positions in software engineering/development. Does anyone have any advice for landing a position (or a position they could help me land <3)?

Post Photo

Hi, I’m looking for a production co in London who has great directors who can direct talking head interviews on location. Any suggestions?


How long it takes to get the technical interview result?


Hi Fishes

If anyone has given an interview in D.E Shaw, please let me know about technical rounds ?


Hey all,
I was wondering how accurate indeed salary estimates are? I live in a LCOL area in PA, and the estimate for the company I’m interviewing with is 67k - 85k. They’re a relatively big tech company and I’m applying to be a Business Development Specialist. Thank you in advance!


More Posts

Has anyone heard of a company called Vanta? Thoughts?


Can anyone please Refer me for a SAP PP job?


Are any firms taking advantage of the government’s wage subsidy for employers? The one requiring a 15% revenue decrease?


What career paths/industries are people in where $250k+ is the norm at 30yrs old?

And then $450k+ at 40?

Please help lol.


Anyone online now that’s on a Southern Hemisphere island? Would like to just fish for a few minutes to see what different fish I can get.


Mergers? Fcb and McCann health probably merging? What do you think? And who stays who gets canned


Does anyone have insights on the company culture company culture comparison between Abbvie and BMS? Any other pros/cons of either company?


How to claim an internet broadband bill in Mindtree?

Just wondering.. L&D Specialist salary and duties for others. Degree? No degree?

I wish more agencies would be honest with us recent grads instead of telling us what "they" think we want to hear. Seriously, how hard is it to gage whether clients will give money for new hire?


Hi all! Will my application be still competent if I was offered GMAT waiver? Vs someone who has GMAT score. Any ideas?


Thinking about starting my own marketing science company. Nothing large scale just work on it part time and see where it takes me. Still thinking of offering general data science service or focus on building out some specialized platform. Any suggestions?


For those who travel with their jobs (boot camps, visiting clients, or other institutions in the same industry, etc.), what are some pros and cons or it? The role has cyber policy involved with it for other institutes within the cyber division


Any link to check holidays for Bangalore DC?

I just received a tentative offer as a sys admin for a subprime contractor at a rate of 80 dollars per hour. I was wondering if anyone understands how contracting works and if you think I'd be able to negotiate for a higher rate. They made it seem like positions salary is based on limitations of the contract. Any explanation about how this stuff works would be very helpful...thanks


How many progression grades/levels are there for a Senior in Tax service line? And what would be average pay for a senior and manager in tax?


Additional Posts in C++ Developers

Any openings in your respective organisations? I am serving a notice period

Has anyone tried turing jobs here?
It is really hard to find C++ jobs these days.
Are there any remote jobs even available?

Nielson - 27 fixed + 3 variable + 2 JB
Genesys - still negotiating on this
KPIT - 28 - Fixed
Genesys Telecommunications Laboratories Inc
Which one is better? YOE 8 yrs 8 months

Hi All,

I got offer from Fujitsu for C++ developer i feel that it's a good opportunity to learn new skills along with C++.
I already have 9.1LPA + 35K yearly incentive and i got 12LPA Fixed in Fujitsu.

YOE: 3.6 years

I'm in process of making a decision. Please help.

Is Fujitsu good company for career development nd learn new skills?

I have been told by the HR that they have yearly two appraisal policy in Fujitsu, is this correct?


Hi Fishes,

I am looking for remote based job with C++ skill set.

Any chance i will get , please update your suggestions regarding organization name.

YOE : 7.2 years.


This is a new group. Please add more people so that we can contribute to c++ development role availibilities and help each network with c++ developers worldwide.


How Is the future of C++ language . I have been working on c++ for almost 1.5 years in a health care industry to maintain legacy code base.
But my current pay is only 10 lpa. While my friends in full stack developer role is earning twice my package .

So I am confused , will the package get better if I switch companies ???? Or is it better to switch the tech stack itself ????

I like c++ coding much more than any language .but package is also my concern.

Thanks in advance


I have 3+ years of experience in c++ developer . Please let me know if there are openings available, looking for Pune location and remote.

Looking for C++ developers for India Bangalore location. Please reach out if interested or refer your friends to me.


Hi All , I am looking for switch with C++ skill set in linux/windows OS with 2 YOE , any organization having opening ?

New to Fishbowl?

Download the Fishbowl app to
unlock all discussions on Fishbowl.
That was just a preview…
Sign Up to see all discussions
  • Discover what it’s like to work at companies from real professionals
  • Get candid advice from people in your field in a safe space
  • Chat and network with other professionals in your field
Sign up in seconds to unlock all discussions on Fishbowl.

Already a user?
Login here


Embed this post

Copy and paste embed code on your site


Download the
Fishbowl app

See what’s happening in your industry
from the palm of your hand.

A phone with Fishbowl app

Send download link to your phone


Scan your QR code to download
Fishbowl app on your mobile

By continuing you agree to Terms of Use and Privacy Policy.

Messaging rates may apply

Download app

Sign up for free to view this conversation on Fishbowl

By continuing you agree to Terms of Use and Privacy Policy

Already have an account? Log in

Sign up for free to continue using Fishbowl

By continuing you agree to Terms of Use(New) and Privacy Policy(New)
Messaging rates may apply

Already have an account? Log in

For account settings, visit Fishbowl on Desktop Browser or