Skip to content
Menu
Code for Java c
  • Home
  • Java
    • Java Examples
    • Java tutorials
  • C
    • C tutorials
    • C Examples
  • C++
    • C++ Tutorials
    • C++ Examples
  • Python
    • Python Tutorials
    • Python Examples
  • About
    • About me
    • contact us
    • disclaimer
    • Privacy Policy
Code for Java c

String Handling in C Programming Language

Posted on August 26, 2017January 21, 2020

Table of Contents

  • String Handling in C Programming Language
    • Memory presentation of string in C using char array
    • String manipulation
    • Related

String Handling in C Programming Language

In this tutorial, we will discuss the concept of String Handling in C Programming Language.

 

In this tutorial, we will explain String handling and their operations ic C language. We have to handle String in C language using character array because there is no special data type for String in C language. The array of characters or set of characters can be called String in C.

char is one of the variable types in C language that contains a single character. But, the set of character is also known as an array of character represents a string in C language.

The array of characters are terminated by a null of character “n”;

Memory presentation of string in C using char array

char greeting[]=”Hello”;  //Declaration and initialization char in C

String Handling in C Programming Language
character array

String manipulation

Example of Strings

  • Name of the person
  • Address of the house
  • Name of items

Declaration of String

Declare of a String in C Language two ways

  1. Using an Array
  2. Using a Pointer

Using an Array

    Diclaration                                                                                                                                       

Syntex

char c[];

or

char c[25];


Initialization of String                                                                                                                      

char c[]=”kanthan”;

or

char c[20]=”kanthan”;

or

char c[]={‘k’,’a’,’n’,’t’,’h’,’a’,’n’}

or

char c[7]={‘k’,’a’,’n’,’t’,’h’,’a’,’n’}

Using Pointer

    Declaration and Initialization of String

Syntex

char *c=””kanthan;;

Example 1

String Handling in C Programming Language
Example

When the above code is executed, it produces the following result

His name is kanthan

Example 2

String Handling in C Programming Language
Example
When the above code executed, produced following result

Enter youe name...
Devid peris

Your nane is Devid

Example character and pointer

 

String Handling in C Programming Language
Example
When the above code was executed, it produced the following result
kamalan
 Suggetsed for you
String function in C language
Single dimensional array in C language
Pointer in C language
Arithmetic function in C language
Method in Java language
Python language methamatical function
C++ programming methamatical function

 

Related

Recent Posts

  • Multiply two numbers in Java using scanner| 5 different ways
  • 5 different ways to Divide two numbers in Java using scanner
  • Learn 8 Ways to Subtract Two Numbers Using Methods in Java
  • 10 ways to subtract two numbers in Java
  • Java Code Examples – Multiply Two Numbers in 5 Easy Ways
  • How to Divide two numbers in Java| 5 different ways

tag

Addition (8) Array (38) C++ language (91) C language (98) c sharp (23) Division (8) Function (29) if else (32) Java language (108) JavaScript (5) loops (138) Multiply (8) Oop (2) patterns (66) PHP (13) Python Language (38) Subtraction (9) temperature (20)

Archives

Categories

Address

Global information technology

Puloly south, PointPedro

Jaffna

Srilanka

©2026 Code for Java c | Powered by SuperbThemes