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
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 |
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 |
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 |
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 |
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 |
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 |
What is a stl vector?
Explain when u will use Observer pattern and how u will implement in c++ .
Write a program in C++ to concatenate two strings into third string using pointers
why we are using the fork command?.. how it works?
Find the error in the following program struct point {struct point *next; int data; } x; main() {int...data; } x; main() {int i; for(x=p;x!=0;) x=x->next,x++; freelist(x); } freelist(x) {free(x); return }
What are the different types of stl containers?
How the STL's are implemented, What the difference between templates and STL?
sir please send me bpcl previous question papers
0 Answers BPCL Bharat Petroleum,
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
wap in c++ which accept a integer array and its size as argument and replaces element having even values with its half and element having odd values with twice its value
What Is Operator Overloading in C++?
write a piece of c++ code which allocate memory to the 50 object of type CObj