SOLUTIONS TO C QUERIESThe solution of the queries is as per their numbers
1.
o/p:i=0
In the expression !i>40 not has higher precedencethan >Forward2.
o/p:1
#define macro replaces int by char3.
o/p:56
i++ will be given 7 for the first timeand then it is incremented ,so 7*8=56
4.
o/p:6
\ cannot be considered as character and\n is for next line5.
o/p:0 0 1 3 1
AND operator has higher precedence over logical OR,so the expression i++&&j++&&k++ is executed first ,gives 0 and 02 gives 1 so m=1
6.
LINKER ERRORMemory allocated in other program andaddress given in current program
This is a blog about the c and c++ (god’s progrramming language as called by me). This blog contains all the stuff required for a c and c++ programmer ranging from history of these languages to interesting codes. check out all the pages of this blog and please dont hesitate to leave a comment. This blog is my first priority,so i will be updating the contents more frequently with out truncating the old data. And please suggestions are always appreciated.
Wednesday, February 4, 2009
Simple C queries
SOME INTERSTING QUERIES IN 'C'
Here are some queries in c.If any comment on any query Pleasemention the query number in your comment.
For answers of these queries watch the 'solutions of c queries' post
The queries will be updated once in a week,so keep in touch with this blog1.
main(){
int i=10;i=i!>40;printf("i=%d",i);
}
2.
#define int charmain(){
int i=65;printf("%d",sizeof(i));
}3.
void main()
{int i=7;printf("%d",i++*i++);
}4.void main()
{char *s="\12345s\n";printf("%d",sizeof(s));
}5.
main()
{int i=-1,j=-1,k=0,l=2,m;m=i++&&j++&&k++l++;printf("%d %d %d %d",i,j,k,l,m);
}6.
main(){
extern int i;i=20;printf("%d",i);
}
Here are some queries in c.If any comment on any query Pleasemention the query number in your comment.
For answers of these queries watch the 'solutions of c queries' post
The queries will be updated once in a week,so keep in touch with this blog1.
main(){
int i=10;i=i!>40;printf("i=%d",i);
}
2.
#define int charmain(){
int i=65;printf("%d",sizeof(i));
}3.
void main()
{int i=7;printf("%d",i++*i++);
}4.void main()
{char *s="\12345s\n";printf("%d",sizeof(s));
}5.
main()
{int i=-1,j=-1,k=0,l=2,m;m=i++&&j++&&k++l++;printf("%d %d %d %d",i,j,k,l,m);
}6.
main(){
extern int i;i=20;printf("%d",i);
}
Tuesday, February 3, 2009
structured VS Object oriented programmming
There are advantages as well as disadvantages to using either structured programming languages or object-oriented languages when developing an application.
c is a structured while c++ is Object oriented language.
There is an advantage to using structured programming when writing classes and complex functions are not necessary. It can take up more time and energy to develop classes rather than simply write a straightforward piece of code, which executes a specific set of commands. It depends on what the overall purpose of the program is. One of the main disadvantages to using a structured programming language versus an object-oriented language is that it is not ‘modular’. In other words, the code is not split up into reusable sections. The code is written and executed sequentially; therefore you may have redundant code. It may take longer to develop programs using structured language
One of the advantages to using object-oriented programming languages is that it is modular. It is possible to write a reusable piece of code, such as a function or a class, which can be used multiple times throughout a program without having to rewrite it. This can save the developer much time and effort in the development process. One of the possible disadvantages to using an object-oriented programming language is its sheer complexity. It is not typically recommended to use object-oriented languages when developing smaller, less complex programs or programs that are built to run on low powered computers
c is a structured while c++ is Object oriented language.
There is an advantage to using structured programming when writing classes and complex functions are not necessary. It can take up more time and energy to develop classes rather than simply write a straightforward piece of code, which executes a specific set of commands. It depends on what the overall purpose of the program is. One of the main disadvantages to using a structured programming language versus an object-oriented language is that it is not ‘modular’. In other words, the code is not split up into reusable sections. The code is written and executed sequentially; therefore you may have redundant code. It may take longer to develop programs using structured language
One of the advantages to using object-oriented programming languages is that it is modular. It is possible to write a reusable piece of code, such as a function or a class, which can be used multiple times throughout a program without having to rewrite it. This can save the developer much time and effort in the development process. One of the possible disadvantages to using an object-oriented programming language is its sheer complexity. It is not typically recommended to use object-oriented languages when developing smaller, less complex programs or programs that are built to run on low powered computers
Visual Information
The graph show the Job ads vs different proggraming language in U.K in 2007.wonder where is 'c'??
Well frankly speaking c is not widely used now a days in big applications .
However,with out the concept of c programming language its not easy
for a programmer to be thorough with the object oriented languages.
It's like learning a foreign language with out knowing native language
C and C++ gods programming language

This is a blog about the c and c++ (god's progrramming language as called by me).This blog contains all the stuff required for a c and c++ programmer ranging fromhistory of these languages to interesting codes.check out all the pages of this blog and please dont hesitate to leave a comment.This blog is my first priority,so i will be updating the contents more frequentlywith out truncating the old data.And please suggestions are always appreciated.
Subscribe to:
Posts (Atom)