Give the output of the following program
main()
{char *p='a';
int *i=100/*p;
}
what will be the value of *i= 1


Answers were Sorted based on User's Feedback



Give the output of the following program main() {char *p='a'; int *i=100/*p; } what w..

Answer / satish

int *i=100/*p;

here in this line /*p is like starting a comment so it shuld
terminate ....

so answer is error ...

Is This Answer Correct ?    11 Yes 0 No

Give the output of the following program main() {char *p='a'; int *i=100/*p; } what w..

Answer / srinivasa. p

No,

It should give error.
1. char* not suppose to assign character.
2. and int *..assign to reference or allocate memory.

Is This Answer Correct ?    6 Yes 1 No

Give the output of the following program main() {char *p='a'; int *i=100/*p; } what w..

Answer / mishra

Its showing error on first line in HPUX.

char *p='a';
Error:-
======
error 1522: Cannot initialize a pointer with an integer
constant other than zero.

Is This Answer Correct ?    2 Yes 0 No

Give the output of the following program main() {char *p='a'; int *i=100/*p; } what w..

Answer / jeetu

To add with Mr. Mishra's answer.
int *i=100/*p;
=========
Error 1 error C2440: 'initializing' : cannot
convert from 'int' to 'int *'

Is This Answer Correct ?    1 Yes 0 No

Give the output of the following program main() {char *p='a'; int *i=100/*p; } what w..

Answer / ashwin

it should be an error.
int *i does not have semicolon at end since /*p is a
comment beginn'.

Is This Answer Correct ?    1 Yes 0 No

Give the output of the following program main() {char *p='a'; int *i=100/*p; } what w..

Answer / anita sachdeva

yes,
*p='a'
*i=100/*p i.e. 100/97
=1
hence *i=1

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More STL Interview Questions

Why should a c++ programmer be interested in stl?

0 Answers  


What is stl in c++ with example?

0 Answers  


What is meant by stl in c++?

0 Answers  


why & sign is used in copy constructor

4 Answers  


Is stl part of c++ standard?

0 Answers  






Diffrernce Between Overloading and Overriding?

2 Answers   Wipro,


Give two integer arrays A & B.A has n elements and B has ' n-1 ' elements . A has all the elements that are there in B. But B has one missing element. Write a function that takes arrays , A & B as imnput and finds the missing element in most optised manner .

4 Answers   Zycus Infotech,


Describe the My Computer and My Documents folders; identify the elements that are present in every Window.

0 Answers  


What is the STL?

2 Answers   Epson, HP,


method overloading means what?

2 Answers   CTS,


how to use C++?

0 Answers   NIIT,


what is electronic software

1 Answers  


Categories