Pages

Sunday, July 10, 2011

C - Logics part-1

Follow the following programs written below :-
1. 

#include<stdio.h>
int lmn();
int pqr();
int ppp();
int hhh();
int fff();
void main()
{
 printf("%d %d %d %d",lmn(), pqr(), ppp(),hhh(), fff());
}
int lmn()
{
printf("One\n");
return 1;
}
int pqr()
{
printf("two\n");
return 2;
}
int ppp()
{
printf("Three\n");
return 3;
}
int hhh()
{
printf("Four\n");
return 4;
}
int fff()
{
printf("five\n");
return 5;
}
/* Try to understand output of this by your own.
-----------------------------------------------------------------
2.

#include<stdio.h>
void main()


{
int x,y;
x=10;
y=10;
printf("%d %d %d\n",x*y,x++,y++);


}


Output:-
121 10 10


-----------------------------------------------------------------
3.
#include<stdio.h>
void main()


{
int x,y;
x=10;
y=10;
printf("%d %d %d\n",x*y,++x,++y);


}




Output:-
121 11 11


-----------------------------------------------------------------
4.


#include<stdio.h>
void main()


{
int x,y;
x=10;
y=10;
printf("%d %d %d %d\n",x*y,--x,++x,++y);


}




Output:-
110 10 11 11

-----------------------------------------------------------------
5.


#include<stdio.h>
void main()


{
int x,y;
x=10;
y=10;
printf("%d %d %d %d\n",x*y,x--,++x,++y);


}




Output:-
110 11 11 11

-----------------------------------------------------------------
Note:- If you get doubts in any program then plz ask me by doing comments.
-----------------------------------------------------------------

C (programming language)


C (pronounced /s/, like the letter C) is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.
Although C was designed for implementing system software it is also widely used for developing portable application software.
C is one of the most popular programming languages of all time and there are very few computer architectures for which a C compiler does not exist. C has greatly influenced many other popular programming languages, most notably C++, which began as an extension to C.

C is an imperative (procedural) systems implementation language. It was designed to be compiled using a relatively straightforward compiler, to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal run-time support. C was therefore useful for many applications that had formerly been coded in assembly language.
Despite its low-level capabilities, the language was designed to encourage cross-platform programming. A standards-compliant and portably written C program can be compiled for a very wide variety of computer platforms and operating systems with few changes to its source code. The language has become available on a very wide range of platforms, from embedded microcontrollers to supercomputers.

C also exhibits the following more specific characteristics:
  • Partially weak typing; for instance, characters can be used as integers
  • Low-level access to computer memory by converting machine addresses to typed pointers
  • Function and data pointers supporting ad hoc run-time polymorphism
  • array indexing as a secondary notion, defined in terms of pointer arithmetic
  • A preprocessor for macro definition, source code file inclusion, and conditional compilation
  • Complex functionality such as I/O, string manipulation, and mathematical functions consistently delegated to library routines
  • A large number of compound operators, such as +=-=*=++, etc.

----------------------------------------------------------------------------------