Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Tapas Kumar Ghosh
Page 2 of 19
How to disable text selection highlighting using CSS?
To disable text selection highlighting using CSS, you can prevent users from selecting and copying content. The CSS user-select property controls whether the user can select text within an element. Syntax selector { user-select: value; } Possible Values ValueDescription noneText cannot be selected by the user autoDefault behavior, text can be selected textText can be selected by the user allAll content of the element will be selected atomically Example: Disabling Text Selection The following example shows how to disable text selection on specific content using the ...
Read MoreHow to design initial letter of text paragraph using CSS?
The CSS ::first-letter pseudo-element is used to style the first letter of a text paragraph. This allows you to apply specific styles to the initial letter of the first line of a block-level element, making it stand out with different font size, color, or style. Syntax selector::first-letter { property: value; } Common Properties The following properties are commonly used with ::first-letter − PropertyDescription font-sizeSets the size of the first letter colorChanges the color of the first letter floatCreates drop cap effect line-heightControls vertical spacing marginAdds space around the ...
Read MoreHow to display a link using only CSS?
To display a link using CSS, we can style anchor elements with various properties to control their appearance and behavior. CSS allows us to customize how links look, whether they appear active or disabled, and how users interact with them. Syntax a { color: value; text-decoration: value; pointer-events: value; cursor: value; } Properties Used The following CSS properties are commonly used to style links − PropertyDescription colorDefines the color of the link text text-decorationControls underline, overline, ...
Read MoreHow to style a select dropdown with only CSS?
The element creates dropdown lists for forms, but its default appearance is limited. While complete customization of native select elements has restrictions, we can apply various CSS properties to improve their styling and create visually appealing dropdowns. Syntax select { property: value; } select option { property: value; } Key Properties for Select Styling PropertyDescription appearanceRemoves default browser styling borderControls border style and thickness border-radiusAdds rounded corners paddingControls internal spacing background-colorSets background color font-sizeControls text size Example: Basic Select Styling ...
Read MoreIs it safe to delete a void pointer in C/C++?
The void pointer is a pointer which is not associated with any data type. It points to some data location in storage means points to the address of variables. It is also called general purpose pointer. However, deleting void pointers requires careful consideration for memory safety. Is It Safe to Delete a Void Pointer in C/C++? It is not safe to delete a void pointer directly because the compiler needs to know the exact type to call the appropriate destructor and determine the correct memory size to deallocate. Deleting without proper type information can lead to undefined behavior. ...
Read MoreHow to compare pointers in C/C++?
Pointers in C can be directly compared using relational operators to check their memory addresses. This allows us to determine equality, ordering, and relative positions of pointers in memory. Syntax pointer1 == pointer2 // Equality comparison pointer1 != pointer2 // Inequality comparison pointer1 < pointer2 // Less than comparison pointer1 > pointer2 // Greater than comparison pointer1 = pointer2 // Greater than or equal Pointer Comparison in C In C, we can compare pointers using relational operators ...
Read MoreUndefined Behaviour in C and C++
In C programming, undefined behavior refers to situations where the language standard does not specify what should happen. When undefined behavior occurs, the program may produce unpredictable results, crash, or appear to work correctly but fail later under different conditions. Syntax /* Undefined behavior occurs when code violates C language rules */ /* Examples: dereferencing NULL pointers, buffer overflows, etc. */ Common Examples of Undefined Behavior in C Division by Zero Using Uninitialized Variables Dereferencing NULL Pointers Signed Integer Overflow Modifying String Literals 1. Division by Zero Division by zero ...
Read MoreHow to check if a variable is NULL in C/C++?
In C, there is no special method for comparing NULL values. We can use if statements to check whether a variable is null or not. NULL is a macro that represents a null pointer constant, typically defined as (void*)0. Syntax if (pointer == NULL) { /* pointer is null */ } if (pointer != NULL) { /* pointer is not null */ } Example 1: Checking File Pointer for NULL Here, we attempt to open a file in read mode that does not exist on ...
Read MorePrint \"Hello World\" in C/C++ without using header files
In C/C++, we typically use header files to access standard library functions. The printf() function is declared in the "stdio.h" header file and is used to print data to the console. However, it's possible to print "Hello World" without including any header files by declaring the function prototype ourselves. Syntax int printf(const char *format, ...); Method 1: Using printf() Declaration in C In C, we can declare the printf() function prototype directly in our program without including stdio.h. The compiler will link to the standard library automatically − int printf(const char *format, ...
Read MoreWhen to use extern in C/C++
In C, the extern keyword is used to declare a variable or function that is defined elsewhere in the program. It tells the compiler that the variable or function exists, but its actual definition (memory allocation) is in another file or later in the same file. Syntax // Variable declaration using extern extern datatype variable_name; // Function declaration using extern (optional) extern return_type function_name(parameters); Parameters: datatype − The data type of the variable (int, char, float, etc.) variable_name − Name of the variable to be declared return_type − Return type of the ...
Read More