Skip to main content

Posts

Difference between Macro and Function

In this post, we are going to understand difference between macro and function. But before getting started, I want to explain little bit about macro and function to you in an easy way. What is a function? A function can be stated as a group of statements that performs some kind of task. In every C program, you’ll notice at least one function that is main() function. The execution of the program starts from there only. You can divide your code into smaller functions for reducing the size of the body of main() function. Now let us see the syntax of a function. return_type function_name(parameter){ //body of the function } What is a macro? Macros are used to define symbolic constants. It is a preprocessor directive, which means it replaces itself with the value which is given to it. Let us understand it with an example. #include <stdio.h> #define X 3 //macro definition int main(){ int x = 10; printf("%d\n", x + X); //here the value of 'X...

Python Convert String to Integer

In this tutorial you’ll see two ways to convert string to integer in python. As we know we don’t have to declare the datatype while declaring variables in Python. As python will assign a datatype according to our data stored in the variable. But when we’re working with GUI (graphical user interface) then the value fetched from a textbox will be a string by default and or we’re taking value from user using raw_input() method (in Python 2.x) and input() method (in Python 3.x), then that value will also be a string by default. To change that string into a int type variable, we can use two different methods as given below. Let’s say our program is: #program to add two numbers in python 3 number1 = input("enter number 1:") number2 = input("enter number 2:") sum = number1 + number2 print("sum = " + sum) Output:  enter number 1:  40 enter number 2:  50 sum  = 4050 A s we can see in above program the input() method returns a string that’s why the resul...

7 Best Github Alternatives in 2018

Here you will get list of some best github alternatives that provide private and public repository. Being into software development we very often find ourselves in the need to host our code to any website. For the purpose, masses are blindly following one single medium for this, Github. It can not be denied that Github users have their choice to use either Git or Subversion for version control. Also there is a facility of unlimited public code repository for all users of Github. One more fascinating feature of Github is that allows to create ‘organizations’, which at its own is a normal account but at least one user account is required to be listed as the owner of the organization. Apart from providing desktop apps for Windows and OSX, Github also provides the facility to its users and organizations to host one website and unlimited project pages for free on the Github’s website. The typical domain for the hosted websites look something like username.github.io and address of the ...

5 Best Python IDEs for Windows/Mac/Linux

Here you will get list of best python ides for windows, mac and linux operating system. Most of us think that Almost all the basic programs in any programming languages can be written using a text editor and can be run by command line then why we need to use an IDE (Integrated development environment)? Let’s suppose you are writing a program. First you’ll need a text-editor like notepad, gedit, notepad++, vim editor or sublime etc. To run it we need to use command line then the command line will compile your source code and check whether there is any error or not. We have to write the code accurately. If any error occurs then again we have to debug the code. Writing a code using a text-editor is a time-taking task and you’ve to remember all the methods or properties given by the particular language. On other hand an IDE (Integrated Development Environment) is a software that contains all of the necessary needs to make programs at one place just like a code editor, build automation t...