Welcome, To Be Efficient


Saturday, September 10, 2011


P L T, Programming Logics and Techniques are necessary for every computer people, and the efficient knowledge of PLT makes them an efficient programmer. In this chapter I will discuss P L T using programming language C, which is the dominant language for the Embedded Development then the assembly language.
Learn programming is a lot similar to learning a language that people speak like English or German. The best way to learn a 'human' language is to start speaking, listening, and repeating, and then checking out the grammar to make the language efficient. The Similar Method can be applied to the language C, we need to start writing programs as quickly as possible. So in this chapter includes lots of sample that make you PLT and efficient. 
1.     First Program – The Good Morning Program
The Hello world program is the basic program that ever seen in lots of books. It is the best starting program. You can even print your name. We must need an Editor 
and compiler to run the program. The Code for the program:

// Good Morning Program
#include
#include
void main()
{
clrscr();
printf(“\nGood  Morning\n”);
getch();
}


Save this code into a file, and call the file goodmorning.c, then compile and run  it by

Turbo C Compiler
Compile       Alt+ F9 or from the menu  compile > compile
Run        Ctrl + F9 or from menu run > run


A C program consists of functions, variables, constants and operator etc. The functions specify the tasks to be performed by the program. The Good Morning Program has one function called main. This function tells your program where to start running.  Main functions are normally kept short and calls different functions to perform the necessary sub-tasks. All C codes must have a main function.
Also notice that C is case-sensitive. The commands have to be written like they are above. C also denotes the end of statement with a semi-colon. Brackets signify either to "{" begin a group of statements, or "}" end a group of statements. The // or /* comment */ designates a comment. Anything after two slashes the compiler ignores. The last part of the program you should notice is the #include. This simply includes a group of functions from the filename specified between then less than and greater than signs (<...>). The file above stdio.h contains a list of standard functions for C to use, the function the our above program uses is printf. Printf takes a string of characters between quotation marks, and outputs them to the screen.

No comments:

Post a Comment

Disclaimer

.........................................................................................................................................................
The all content are through my experiences, that i have learn in going through Studies and in building projects, some of were taken from some web sites, books and other sources, where i have visited and learn the concepts, I am very thankful to them for having those valuable things, which make me more efficient, and i have added those all in my experience. If any of these content violets copyrights, please contact me i will try to resolve and will do the needful assistance. Thank you all very much.
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................