Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts
Monday, February 16, 2015
The History of Programming Languages Infographic
In this article I am sharing an awesome infographic about history of various popular programming languages with there short introduction.
Also Read: The Top 10 Greatest Programmers in the World of all Time

Source: http://blog.veracode.com/2013/04/the-history-of-programming-languages-infographic/
Also Read: The Top 10 Greatest Programmers in the World of all Time
Source: http://blog.veracode.com/2013/04/the-history-of-programming-languages-infographic/
Labels:
history,
infographic,
languages,
of,
programming,
the
Sunday, February 15, 2015
Functions in C Programming Part 2
Read: Functions in C Programming - Part 1
In my last tutorial I gave an overview to the functions in C programming. Today I will tell you about the multiple calls within one function and its nuances. So without wasting any time lets head over to a program.
Output

A simple concept to learn
Suppose main() function calls another function msg(). When the control reach to the msg() function then the activity of main() will be suspended temporarily. After executing all the statements from the msg() function, the control will automatically goes to the original calling function (main() in our case).
Explanation
Points to Remember
1. Any C program contains at least one function and it should be main().
void main()
{
msg();
}
5. We can call one function any number of times.
void main()
{
msg();
msg();
}
6. A function can also called by itself. Such an execution is called recursion.
7. We cannot define one function inside another. We can only call one function from another.
In my last tutorial I gave an overview to the functions in C programming. Today I will tell you about the multiple calls within one function and its nuances. So without wasting any time lets head over to a program.
Functions in C Programming
#include<stdio.h>
void firstfu();
void secondfu();
void thirdfu();
void fourthfu();
void main()
{
printf(" Control is in main
");
firstfu();
}
void firstfu()
{
printf(" Now the control is in firstfu function
");
thirdfu();
}
void secondfu()
{
printf(" Now the control is in secondfu function
");
fourthfu();
}
void thirdfu()
{
printf(" Now the control is in thirdfu function
");
secondfu();
}
void fourthfu()
{
printf(" Now the control is in fourthfu function
");
}
Output

Suppose main() function calls another function msg(). When the control reach to the msg() function then the activity of main() will be suspended temporarily. After executing all the statements from the msg() function, the control will automatically goes to the original calling function (main() in our case).
Explanation
- The program starts with main() function and it will print the message inside it. After that I have called the firstfu() function from main(). Remember here main() is calling function and firstfu() is called function.
- Now the control reaches to firstfu() function and the activity of main() function is suspended temporarily. Inside firstfu() function, printf() will print a message. Now I have called thirdfu() function. Remember here firstfu() is calling function and thirdfu() is called function
- Now the control reaches to the thirdfu() function and the activity of firstfu() function is suspended temporarily. And it will execute its printf() function. Now I have called the secondfu() function.
- Same thing will happened to the secondfu() function and it will call the fourthfu() function.
- Now the printf() statement will be executed inside the fourthfu() function. As there is no further call to other function there. So the control will goes back to the calling function. Calling function of fourthfu() is secondfu().
- No more statements is left in secondfu(). So the control will reach to the calling function. thirdfu() is the calling function of secondf().
- Same execution will be done for all of them. And the control will reach to the main() function again. Now no statement is left in main() function, so the program will be terminated.
Points to Remember
1. Any C program contains at least one function and it should be main().
The execution of the program always starts with main() function. We cannot alter it in any case.
2. A typical C program may contain any number of functions. But it should contain one main() function and the program will start executing with main() function.
3. Any function can call any other function. Even main() function can be called from other functions. To call a function we have to write the function name followed by a semi colon.
{
msg();
}
4. We should define a function before calling it. A function can be defined by following below syntax.
5. We can call one function any number of times.
void main()
{
msg();
msg();
}
6. A function can also called by itself. Such an execution is called recursion.
7. We cannot define one function inside another. We can only call one function from another.
Tuesday, February 10, 2015
Hello World Program in Eight Different Popular Programming Languages
This fact is true that Hello World program is the first program that a programmer writes when he/she start learning a new programming language. Today I thought that I should share the hello world program in different languages. A video is also added for easy understanding of the programs. Let’s take a look on these programs.


Hello World Program in Java
class HelloWorld
{
public static void main(String args[])
{
System.out.println("Hello World");
}
}
Hello World Program in C
#include<stdio.h>
main()
{
printf("Hello World");
}
Hello World Program in C++
#include <iostream>
int main()
{
std::cout << "Hello, world";
}
Hello World Program in Javascript
<script>
window.onload = function()
{
document.getElementById(result).innerHTML = "Hello World";
}
</script>
<div id="result></div>
Hello World Program in HTML
Hello World Program in Python
Hello World Program in Perl
Hello World Program in Ruby
Subscribe to:
Posts (Atom)