|
INTERVIEW QUESTIONS
PROGRAMMING LANGUAGES
C
DETAILS
Question: #include <stdio.h> int main() {
int a=3, b = 5; printf(&a["Ya!Hello! how is this? %s "], &b["junk/super"]); printf(&a["WHAT%c%c%c %c%c %c ! "], 1["this"], 2["beauty"],0["tool"],0["is"],3["sensitive"],4["CCCCCC"]);
return 0; }
Answer: Hello! how is this? superThatisC !
Becoz &a will set ptr to 3rd position ie. at H and will print whole string &b will set ptr to 5th position ie. @ s it also print whole string. But in 2nd printf , string will start from 3rd position ie. T and will replace all %c with index which is outside of square bracket from the string inside square bracket.
|
|
|
Category |
C Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.3) By 6710 users |
Added on |
5/19/2013 |
Views |
70144 |
Rate it! |
|
|
Question:
#include <stdio.h> int main() {
int a=3, b = 5; printf(&a["Ya!Hello! how is this? %s "], &b["junk/super"]); printf(&a["WHAT%c%c%c %c%c %c ! "], 1["this"], 2["beauty"],0["tool"],0["is"],3["sensitive"],4["CCCCCC"]);
return 0; }
Answer:
Hello! how is this? superThatisC !
Becoz &a will set ptr to 3rd position ie. at H and will print whole string &b will set ptr to 5th position ie. @ s it also print whole string. But in 2nd printf , string will start from 3rd position ie. T and will replace all %c with index which is outside of square bracket from the string inside square bracket. Source: CoolInterview.com
Answered by: kirankumar | Date: 7/10/2008
| Contact kirankumar
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
How i can run *.bat or *.cmd file by using system function in c ?
|
View Answer
|
|
Why does a linker error occurs for the segment: main() { extern int i; i=20; printf("%d",sizeof(i)); }
|
View Answer
|
|
Can there be a mouse click and drag function used together to rotate a circle in c?please give which are they?
|
View Answer
|
|
Can there be a mouse click and drag function used in c?
|
View Answer
|
|
Between n+1 and n++ which executes faster or both take the same time to execute?
|
View Answer
|
|
Range of int in is -32768 to 32767 and it occupy 2 byte in memory and char take 1 byte take single char but in java int is 4 byte take value-2,147,483648 to 647 and char occupy 2 byte and also take single variable why not more?`
|
View Answer
|
|
How to connect a database (MS Access) to Borland C? Please give me step by step coding.
|
View Answer
|
|
To which numbering system can the binary number 1101100100111100 be easily converted to?
|
View Answer
|
|
What are bit fields? What is the use of bit fields in a structure declaration?
|
View Answer
|
|
What are enumerations?
|
View Answer
|
|
Write down the equivalent pointer expression for reffering the same element a[i][j][k][l]?
|
View Answer
|
|
What is the use of typedef?
|
View Answer
|
|
Which mistakes are called as token error?
|
View Answer
|
|
What is the function of % using in formatted string.
|
View Answer
|
|
How to print the names of employees or students in alphabetical order using C programming?
|
View Answer
|
|
How should i rate on the basis of the basis of the scenario the insertion sort , bubble sort , Quick Sort?
|
View Answer
|
|
Can we print values from 1 to 100 without using for,while,do-while,if etc.?answer should be logical.
|
View Answer
|
|
How to write a program to print its own source code?
|
View Answer
|
|
What are the advantages of pointers,give me programs containing variables and pointer variables?
|
View Answer
|
|
I want source code of series of prime numbers.
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All C Interview Questions & Answers - Exam Mode /
Learning Mode
|