Filter by Tags

How to declare string in c



0 0
This Question is asked to:

What are the different ways in which we can declare strings in C ?

Ravinder Singh
Posted on : Mon, Feb 19, 2018
Views : 42

Ask Question

If you want to ask question you must LogIn or SignUp
Login SignUp

Answers (1)


There different ways to  declare string in c.

1.initilized unsized array of character-  Array length is not specified while initilizing character array using the approach .array length is automatically calculated by complier  indiviual character  are written inside in single quates.

example: char name[]={'h','e','l','l','o,'\o'};

2.initilized string directly-  directly assigning string to variable by writting text in double quotes.

example: char name="hello";

3.initilized string using character pointer-   variable pointer type so that it can hold the base address of "string".base address means address of first array element .



Jaspreet kaur
Tue, Feb 20, 2018

Edit Answer

This answer will permanently deleted. Do you really want to delete this Answer ?
To Add your Answer Please
LogIn | SignUp

Quick Links



Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..


Login to Open ESchool OR Create your account    Login   SignUp