?
Solved

What is (int)(blah)int

Posted on 1999-10-25
9
Medium Priority
?
204 Views
Last Modified: 2010-04-16
I was given this question at an interview, and have been wondering ever since.  Any ideas?
0
Comment
Question by:jasbro
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 4

Expert Comment

by:adam923
ID: 2156841
looks like a cast from some compatible-type expression (blah) to an integer.  i have no idea what that int on the end is
an example

double a = 5;
int b=(int) a;
0
 
LVL 2

Author Comment

by:jasbro
ID: 2156849
The int on the end is the confusing part...when I answered, I just put that it was nonsense, but I wanted to know for sure.
0
 
LVL 23

Expert Comment

by:chensu
ID: 2156869
You probably should have answered "Syntax error".
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
LVL 2

Author Comment

by:jasbro
ID: 2156877
Chensu:  Are you sure that it is a syntax error... (a syntax error is simply stating that the statement being evaluated makes no sense in the current context, therefore it is nonsense)
0
 
LVL 4

Accepted Solution

by:
adam923 earned 150 total points
ID: 2156900
i'm looking through the ms vc++ 5.0 help files "c language reference" but i can't find anything to explain that extra int...
and i did get a syntax error when i tried it.  yes, jasbro, the compiler couldn't tell what was going on, therefore syntax error
0
 
LVL 23

Expert Comment

by:chensu
ID: 2156911
Yeah, simply try it with your C++ compiler. It will tell you.
0
 
LVL 2

Author Comment

by:jasbro
ID: 2156930
Chensu:  Do you think everyone is an idiot, obviously that was the first thing I tried.  I was trying to find out if anybody had ever used it (maybe in some other context, not by itself as a simple statement)
0
 
LVL 23

Expert Comment

by:chensu
ID: 2156962
No, don't get me wrong.
0
 
LVL 9

Expert Comment

by:jasonclarke
ID: 2158310
I agree that this is probably gibberish, but you can get fairly close things that compile:

(int)(blah)int();

is OK (in terms of syntax) but you do need something on the end.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question