
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

3K+ Views
Dangling pointerDangling pointer is a pointer pointing to a memory location that has been freed (or deleted). There are different ways where Pointer acts as dangling pointerFunction CallThe pointer pointing to local variable becomes dangling when local variable is not static.int *show(void) { int n = 76; /* ... */ return &n; }OutputOutput of this program will be garbage address.De-allocation of memoryint main() { float *p = (float *)malloc(sizeof(float)); //dynamic memory allocation. free(p); //after calling free() p becomes a dangling pointer p = NULL; //now p no more a dangling pointer. }Variable goes ... Read More

3K+ Views
In C++, both ptr++ and ++ptr are used to increment pointers, but they behave differently in expressions. The difference lies in when the increment happens: before or after the value is used. This is essential when working with loops, arrays, or pointer. Syntax Following is the syntax to compare ptr++ vs ++ptr in C++: ptr++: post-increment; ++ptr: pre-increment; Following is the table to compare ptr++ vs ++ptr in C++ ... Read More

2K+ Views
The valueOf() method of the Date object accepts a String value representing a Date in JDBC escape format i.e. yyyy-mm-dd and converts the given String value into java.sql.Date object.Date date = Date.valueOf(“date_string”);Assume we have created a table named employee_data with the description as shown below:+----------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+--------------+------+-----+---------+-------+ | id | int(11) | YES | | NULL | | | Name | varchar(255) | YES | ... Read More

5K+ Views
In C/C++, every character including 'a' is stored using a specific size in memory. Most of the systems including Linux, the size of a character is 1 byte. This means that any character (like a) can occupy 1 byte(8 bits of memory). To determine how much memory is used by the character 'a', we can use the sizeof() operator. So, it returns the size in bytes of a variable or data type. Following are the list of different ways to check the Standard Size in C/C++. Using sizeof with character literal ... Read More

1K+ Views
The toString() method of the java.sql.Date class returns the escape format: yyyy-mm-dd of the date represented by the current date object. Using this method you can convert a Date object to a String.Date date = rs.getDate("Dispatch_Date"); date.toString());Assume we have a table named dispatch_data 3 records as shown below:+--------------+------------------+---------------+----------------+ | Product_Name | Name_Of_Customer | Dispatch_Date | Location | +--------------+------------------+---------------+----------------+ | KeyBoard | Amith | 1981-12-05 | Hyderabad | | Ear phones | Sumith | 1981-04-22 ... Read More

716 Views
The getTime() method of the java.sql.Date class retrieves and returns the time from the current timestamp in milliseconds (long) from epoch time 1, 1970 00:00:00.000 GMT.//Retrieving the date Date date = rs.getDate("Dispatch_Date");The constructor of the java.sql.Timestamp class accepts a long variable representing the time in milliseconds from the epoch time and constructs the Timestamp object.//Creating a Timestamp object. Timestamp ts = new Timestamp(date.getTime()));Using these, you can convert a Date object to TimeStamp object in JDBC.Assume we have established connection with MySQL database and created a table named dispatch_data using statement object as:Assume we have established connection with MySQL database and ... Read More

512 Views
The C++ interfaces are implemented using abstract classes and these abstract classes should not be confused with data abstraction which is a concept of keeping implementation details separate from associated data. A class is made abstract by declaring at least one of its functions as a pure virtual function. A pure virtual function is specified by placing "= 0" in its declaration as follows : class Box { public: // pure virtual function virtual double getVolume() = 0; private: ... Read More

554 Views
In C++ we can pass arguments into a function in different ways. These different ways are −Call by ValueCall by ReferenceCall by AddressSometimes the call by address is referred to as call by reference, but they are different in C++. Incall by address, we use pointer variables to send the exact memory address, but in call by reference we pass the reference variable (alias of that variable). This feature is not present in C, there we have to pass the pointer to get that effect.In this section, we will see what are the advantages of call by reference over call ... Read More

7K+ Views
To find the Current Working Directory (CWD) in C or C++ is like asking your program: "Hey, where am I right now?". Simply we can say that it is like a folder of your program which is present and used to operate in. We can use functions like getcwd() from unistd.h in C/C++ or filesystem::current_path() from C++17. Below are the list of the ways to achieve this. Using getcwd() in C/C++ Using filesystem in C++17 Using getcwd() Function in C/C++ In C/C++, we use the getcwd() function. This function gets ... Read More

938 Views
In C++, direct memory access is possible using pointers. However, the improper use of pointers can lead to problems such as dangling pointers, null pointers, void pointers, and wild pointers. You must have to fix these problems properly for correct code compilation and execution. Let us learn how these problems occur and how you can fix them. Dangling Pointer A dangling pointer is a variable that points to invalid or freed memory, causing errors if accessed. It is like calling a disconnected phone number. When the local variable is not static, the pointer pointing to it becomes dangling. Syntax Following ... Read More