Welcome To Tutorialspoint.dev
Officially launched 18th May 2019
C C-Input and Output Quiz C

puts() vs printf() for printing a string

In C, given a string variable str, which of the following two should be preferred to print it to stdout? 1) puts(str); 2) printf(str); puts() can be preferre...
C C++ Difference Between

Difference between strlen() and sizeof() for string in C

sizeof() Sizeof operator is a compile time unary operator which can be used to compute the size of its operand. The result of sizeof is of unsigned integral type ...
C Programs C-String cpp-string

Strings in C

Strings are defined as an array of characters. The difference between a character array and a string is the string is terminated with a special character ‘&#x...
Articles C C Array and String

C function to Swap strings

Let us consider the below program. #include<stdio.h> void swap(char *str1, char *str2) {   char *temp = str1;   str1 = str2; ...
Articles C C Array and String

Storage for Strings in C

In C, a string can be referred to either using a character pointer or as a character array. Strings as character arrays char str[4] = "GfG"; /*One...
C C++ C Array and String

How to write long strings in Multi-lines C/C++?

Image a situation where we want to use or print a long long string in C or C++, how to do do this? In C/C++, we can break a string at any point in the middle using tw...
Strings String Duplicates Strings

Print all the duplicates in the input string

Write an efficient C program to print all the duplicates and their counts in the input string Algorithm: Let input string be “geeksforgeeks” 1: Constr...
Strings Amazon cpp-pair

Given a string, find its first non-repeating character

Given a string, find the first non-repeating character in it. For example, if the input string is “GeeksforGeeks”, then output should be ‘f&#x2...
C C-Data Types c-puzzle

What is the best way in C to convert a number to a string?

Solution: Use sprintf() function. #include<stdio.h> int main() {     char result[50];     float num = 23.3...
C C-String C

How to find length of a string without string.h and loop in C?

Find the length of a string without using any loops and string.h in C. Your program is supposed to behave in following way: Enter a string: GeeksforGeeks (Say user e...

Subscribe to Our Newsletter