Found 33676 Articles for Programming

Pass an array by value in C

Tapas Kumar Ghosh
Updated on 05-May-2025 18:36:54

909 Views

In C programming, when you pass an array by value, you are not sending the entire array. Instead of this, it passes a pointer to the first element. So, this shows functions directly work with an original array but do not copy. Note: If we make any changes to the array element, those changes will be reflected in the original array outside the function as well. Syntax There are two syntaxes for passing an array by value as follows: i. The syntax of array notation for passing array to function. void function_name(data_type array_name[], int size) { // Function ... Read More

Reverse a string in C/C++

Tapas Kumar Ghosh
Updated on 21-May-2025 18:03:29

2K+ Views

There can be multiple ways to reverse a string in C and C++. In this article, we will learn reversing a string using different approaches with the appropriate examples. Consider the below example with input and output scenarios: Input // characters representation from left to right inp = "Tutorialspoint" Output // characters representation from right to left out = tniopslairotuT Now, we have following approaches to solve the reverse of a given approach: Using Two Pointer Using reverse() Function Using strlen() Function Reverse String ... Read More

Character arithmetic in C

Tapas Kumar Ghosh
Updated on 21-Apr-2025 18:06:05

6K+ Views

In C, character arithmetic is defined by char data type. This is used to implement arithmetic operations like addition and subtraction on characters in C language. It is used to manipulate the strings. When the characters are used with the arithmetic operations, it converts them into integer value automatically i.e. ASCII value of characters. Understanding Characters Represention To understand the character represented using char data type then learn the ASCII value (integer) of each character. Some values are provided for the references such as, 'A' has an ASCII value of 65 'B' has an ASCII value of 66 'a' has ... Read More

C Program for LowerCase to UpperCase and vice-versa

Ankith Reddy
Updated on 02-Sep-2023 13:20:59

82K+ Views

Here is the program to convert a string to uppercase in C language,Example Live Demo#include #include int main() {    char s[100];    int i;    printf("Enter a string : ");    gets(s);    for (i = 0; s[i]!='\0'; i++) {       if(s[i] >= 'a' && s[i] = 'a' && s[i] = 'A' && s[i] = 'A' && s[i]

Clearing input buffer in C/C++

Arjun Thakur
Updated on 28-Apr-2025 15:39:01

26K+ Views

In C/C++, an input buffer is a temporary storage area where the program processes the input. Suppose, you are an user and you type some characters using a keyboard but those characters are not passed to the program directly because it involves several layers of handling such as keyboard firmware, OS input queues, and event processing. So, they first proceed with the collection of an input buffer. Next, when the program is ready, it reads from the buffer. How Input Buffer Affects a Program? The input buffer affected to the program when we are using the functions like scanf() or ... Read More

Standard header files in C

George John
Updated on 04-Oct-2023 12:26:13

26K+ Views

In C language, header files contain the set of predefined standard library functions. The "#include" preprocessing directive is used to include the header files with ".h" extension in the program. Here is the table that displays some of the header files in C language, Sr.No. Header Files & Description 1 stdio.hInput/Output ... Read More

Header files “stdio.h” and “stdlib.h” in C

Ankith Reddy
Updated on 25-Jun-2020 09:39:07

15K+ Views

stdio.hThe header file stdio.h stands for Standard Input Output. It has the information related to input/output functions.Here is the table that displays some of the functions in stdio.h in C language, Sr.No.Functions & Description1printf()It is used to print the strings, integer, character etc on the output screen.2scanf()It reads the character, string, integer etc from the keyboard.3getc()It reads the character from the file.4putc()It writes the character to the file.5fopen()It opens the file and all file handling functions are defined in stdio.h header file.6fclose()It closes the opened file.7remove()It deletes the file.8fflush()It flushes the file.Here is an example of stdio.h in C language, ... Read More

islessgreater() in C/C++

George John
Updated on 25-Jun-2020 09:40:25

255 Views

The function islessgreater() is used to check that first argument is less than or greater than the second one. It is declared in “math.h” header file in C language. It returns true, if successful otherwise false.Here is the syntax of islessgreater() in C++ language, bool islessgreater(value1 , value2);Here, value1 − This is the first argument which will be checked with value2.value2 − This is the second argument which is used to check value1 and see that is less or greater.Here is an example of islessgreater() in C++ language, Example Live Demo#include #include using namespace std; int main() {    int ... Read More

Convert a C++ String to Upper Case

Tapas Kumar Ghosh
Updated on 11-Apr-2025 18:26:32

826 Views

In C++, converting a string into uppercase means changing all the characters into uppercase. This is a common requirement in many applications, such as formatting output, standard data input, and case sensitivity. Following is the table that shows the conversion of string to uppercase: String Case Characters Uppercase Characters ... Read More

isless() in C/C++

Arjun Thakur
Updated on 25-Jun-2020 09:42:06

380 Views

The function isless() is used to check that first argument is less than the second one. It is declared in “math.h” header file in C language. It returns true if successful otherwise it returns false.Here is the syntax of isless() in C language, bool isless(value1 , value2);Here, value1 − This is the first argument which will be checked with value2.value2 − This is the second argument which is used to check value1 ans see that it is less or not.Here is an example of isless() in C language, Example Live Demo#include #include int main() {    int val1 = 48; ... Read More

Advertisements