main()

{

int i=300;

char *ptr = &i;

*++ptr=2;

printf("%d",i);

}

Answers were Sorted based on User's Feedback



main() { int i=300; char *ptr = &i; *++ptr=2; printf(&quo..

Answer / susie

Answer :

556

Explanation:

The integer value 300 in binary notation is: 00000001
00101100. It is stored in memory (small-endian) as:
00101100 00000001. Result of the expression *++ptr = 2 makes
the memory representation as: 00101100 00000010. So the
integer corresponding to it is 00000010 00101100 => 556.

Is This Answer Correct ?    77 Yes 8 No

main() { int i=300; char *ptr = &i; *++ptr=2; printf(&quo..

Answer / subrat

556

Is This Answer Correct ?    23 Yes 5 No

main() { int i=300; char *ptr = &i; *++ptr=2; printf(&quo..

Answer / giri

cannot convert int * to char * in main

Is This Answer Correct ?    14 Yes 12 No

main() { int i=300; char *ptr = &i; *++ptr=2; printf(&quo..

Answer / bidhu

I think the answer depends on compiler.

In Dev-C++ the result is cannot convert int* to char* error

In Code:Block it gives a warning but gives the result 556

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More C Code Interview Questions

which function is used to clear the buffer stream on gcc? for example: I wrote following code on gcc #include<stdio.h> int main(void) { char ch; int a,b; printf("\nenter two numbers:\t"); scanf("%d%d",&a,&b); printf("enter number is %d and %d",a,b); printf("\nentercharacter:\t"); scanf("%c",&ch); printf("enter character is %c",ch); return 0; } in above progarm ch could not be scan. why?plz tell me solution.

2 Answers  


main() { struct date; struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }

1 Answers  


main() { clrscr(); } clrscr();

2 Answers  


main() { int i=-1; +i; printf("i = %d, +i = %d \n",i,+i); }

1 Answers  


I need your help, i need a Turbo C code for this problem.. hope u'll help me guys.? Your program will have a 3x3 array. The user will input the sum of each row and each column. Then the user will input 3 values and store them anywhere, or any location or index, temporarily in the array. Your program will supply the remaining six (6) values and determine the exact location of each value in the array. Example: Input: Sum of row 1: 6 Sum of row 2: 15 Sum of row 3: 24 Sum of column 1: 12 Sum of column 2: 15 Sum of column 3: 18 Value 1: 3 Value 2: 5 Value 3: 6 Output: Sum of Row 1 2 3 6 4 5 6 15 7 8 9 24 Sum of Column 12 15 18 Note: Your program will not necessary sort the walues in the array Thanks..

0 Answers  






find simple interest & compund interest

2 Answers  


main() { int i; clrscr(); printf("%d", &i)+1; scanf("%d", i)-1; } a. Runtime error. b. Runtime error. Access violation. c. Compile error. Illegal syntax d. None of the above

1 Answers   HCL,


In a gymnastic competition, scoring is based on the average of all scores given by the judges excluding the maximum and minimum scores. Let the user input the number of judges, after that, input the scores from the judges. Output the average score. Note: In case, more than two judges give the same score and it happens that score is the maximum or minimum then just eliminate two scores. For example, if the number of judges is 5 and all of them give 10 points each. Then the maximum and minimum score is 10. So the computation would be 10+10+10, this time. The output should be 10 because 30/3 is 10.

0 Answers   TCS,


#include"math.h" void main() { printf("Hi everybody"); } if <stdio.h> will be included then this program will must compile, but as we know that when we include a header file in "" then any system defined function find its defination from all the directrives. So is this code of segment will compile? If no then why?

2 Answers  


write a function to give demostrate the functionality of 3d in 1d. function prototye: change(int value,int indexX,int indexY,int indexZ, int [] 1dArray); value=what is the date; indexX=x-asix indexY=y-axis indexZ=z-axis and 1dArray=in which and where the value is stored??

0 Answers   Nagarro,


void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %d\n",++i); }

3 Answers  


how to print 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 using any loop(for or while) only once(only 1 loop) and maximum 2 variables using C.

19 Answers   Cap Gemini, Infosys,


Categories