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

sir please send me bpcl previous question papers

0 Answers   BPCL Bharat Petroleum,


why & sign is used in copy constructor

4 Answers  


Diffrernce Between Overloading and Overriding?

2 Answers   Wipro,


Explain when u will use Observer pattern and how u will implement in c++ .

1 Answers  


If P is the population on the first day of the year, B is the birth rate, and D is the death rate, the estimated population at the end of the year is given by the formula: The population growth rate is given by the formula: B – D Write a program that prompts the user to enter the starting population, birth and death rates, and n, the number of years. The program should then calculate and print the estimated population after n years. Your program must have at least the following functions: 1. growthRate: This function takes its parameters the birth and death rates, and it returns the population growth rate. 2. estimatedPopulation: This function takes its parameters the current population, population growth rate, and n, the number of years. It returns the estimated population after n years Your program should not accept a negative birth rate, negative death rate, or a population less than 2. please answer my question ....

0 Answers   Microsoft,






What is the name of your birth place?

0 Answers  


what is a template?

2 Answers   Amazon, BITS, IBS, Wipro,


i wanted to know about questions about c,c++ , which is required for placements.... im a fresher

0 Answers   NDS,


5. Write c++ function that would intake a string and return the number of occurrences of a given character in that sring Ex:- if the word is “Colombo” and count the occurrences of the letter “o” the function would return 3

1 Answers  


What is a standard template library (stl)?

0 Answers  


differentiate between private, public and protected data members of the class using example.

1 Answers  


Describe how to safeguard a system through acquisition of an antivirus Program and systematic backup.

0 Answers  


Categories