
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

399 Views
The C library function int rename(const char *old_filename, const char *new_filename) causes the filename referred to by old_filename to be changed to new_filenameFollowing is the declaration for rename() function.int rename(const char *old_filename, const char *new_filename)The parameters are old_filename − This is the C string containing the name of the file to be renamed and/or moved, new_filename − This is the C string containing the new name for the file.On success, zero is returned. On error, -1 is returned, and errno is set appropriately.Example#include int main () { int ret; char oldname[] = "file.txt"; char newname[] = ... Read More

2K+ Views
Here we will see what type of operations can be performed on struct variables. Here basically one operation can be performed for struct. The operation is assignment operation. Some other operations like equality check or other are not available for stack.Example#include typedef struct { //define a structure for complex objects int real, imag; }complex; void displayComplex(complex c){ printf("(%d + %di)", c.real, c.imag); } main() { complex c1 = {5, 2}; complex c2 = {8, 6}; printf("Complex numbers are:"); displayComplex(c1); displayComplex(c2); }OutputComplex numbers are: (5 + 2i) (8 + 6i)This works fine as ... Read More

632 Views
Command Line ArgumentsCommand line arguments are input parameters which allow user to enable programs to act in a certain way like- to output additional information, or to read data from a specified source or to interpret the data in a desired format.Python Command Line ArgumentsPython provides many options to read command line arguments. The most common ways are -Python sys.argvPython getopt modulePython argparse modulePython sys moduleThe sys module stores the command line arguments (CLA) into a list and to retrieve it, we use sys.argv. It’s a simple way to read command line arguments as string.import sys print(type(sys.argv)) print('The command ... Read More

2K+ Views
In this article, we will see how we can create an empty functions in Python. A function is a block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and a high degree of code reusing. Function blocks begin with the keyword def followed by the function name and parentheses ( ( ) ). Here, we will see examples of Empty Functions. Empty Function Use the pass statement to write an empty function in Python −Example # Empty function in Python def demo(): pass Above, ... Read More

340 Views
Here we will see how the preprocessors are working in C or C++. Let us see what are the preprocessors.The preprocessors are the directives, which give instructions to the compiler to preprocess the information before actual compilation starts.All preprocessor directives begin with #, and only white-space characters may appear before a preprocessor directive on a line. Preprocessor directives are not C++ statements, so they do not end in a semicolon (;).You already have seen a #include directive in all the examples. This macro is used to include a header file into the source file.There are number of preprocessor directives supported ... Read More

19K+ Views
The reload() is used to reload a previously imported module or loaded module. This comes handy in a situation where you repeatedly run a test script during an interactive session, it always uses the first version of the modules we are developing, even we have made changes to the code. In that scenario we need to make sure that modules are reloaded. The argument passed to the reload() must be a module object which is successfully imported before. Few points to understand, when reload() is executed − Python module’s code is recompiled and the module-level code re-executed, defining a ... Read More

4K+ Views
Here we will see what is the meaning of volatile qualifier in C++. The volatile qualifier is applied to a variable when we declare it. It is used to tell the compiler, that the value may change at any time. These are some properties of volatile.The volatile keyword cannot remove the memory assignmentIt cannot cache the variables in register.The value cannot change in order of assignment.Let us see, how we can use the volatile keyword.volatile int a; int volatile a;Here these two declarations are correct. Like other datatypes, we can use volatile pointers, structures, unions etc. The volatile structures and ... Read More

735 Views
Here we will see what is re-declaration of global variables in C. Does C supports this or not. Let us see the following code to get the idea about it.Example#include int main(){ int a; int a = 50; printf("a is : %d", a); }Output[Error] redeclaration of 'a' with no linkageSo we can see that we cannot re-declare local variables. Now let us see what will be the output for global variables.Example#include int a; int a = 50; int main(){ printf("a is : %d", a); }Outputa is : 50So global variables are not creating any ... Read More

469 Views
Inplace Operator in PythonInplace operation is an operation which directly changes the content of a given linear algebra or vector or metrices without making a copy. Now the operators, which helps to do this kind of operation is called in-place operator.Let’s understand it with an a simple example -a=9 a += 2 print(a)output11Above the += tie input operator. Here first, a add 2 with that a value is updated the previous value.Above principle applies to other operators also. Common in place operators are -+=-=*=/=%=Above principle applies to other types apart from numbers, for example -language = "Python" language +="3" print(language)OutputPython3Above ... Read More

100 Views
Here we will see how the C variables are scoped. The variables are always statically scoped in C. Binding of a variable, can be determined by the program text. These are independent of runtime function call stack.Let us see one example to get the idea.Example# include int x = 0; int my_function() { return x; } int my_function2() { int x = 1; return my_function(); } int main(){ printf("The value is: %d", my_function2()); }OutputThe value is: 0Here the result is 0. Because the value returned by my_function() is not depends on the function, which is ... Read More