Sunday, May 8, 2011

C - Aptitude Questions 1-46

Predict the output or error(s) for the following:
1. void main()
{ int const * p=5; printf("%d",++(*p));
}
Answer:
Compiler error: Cannot modify a constant value. Explanation: p is a pointer to a "constant integer". But we tried to change the value of the "constant integer".

Data Structures Aptitude Question

1. What is data structure?
A data structure is a way of organizing data that considers not only the items
stored, but also their relationship to each other. Advance knowledge about the
relationship between data items allows designing of efficient algorithms for the
manipulation of data.