answersLogoWhite

0


Best Answer

Some strings are constants, others aren't; some constants are strings, other aren't. So these are unrelated things. Examples:

"text" -- constant string

123 -- constant number

char s[40] -- variable string

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

A string constant is simply an array of char, with constant value.

char abc[] = "This is a test";

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How string constants are declared in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the role of plus operator between two string constant?

The plus operator between string constants allows string concatination: string a = "Hello, "; string b = "World!"; string c = a + b; The output of c would be: "Hello, World!".


Function finds the occurrence of a given string in another string?

in C: strstr, declared in string.h


Coding constants in c?

Coding constants in c means writing the constants in a certain way that the c language understands.


What is return type of string in c?

In C programming, a string doesn't have a specific return type as it's essentially an array of characters. So, if a function is returning a string, it should be declared to return a pointer to a char (char*), since a string in C is represented as an array of characters terminated by a null character ('\0').


Explain different types of constant?

Integer constants Character constants Real/floating point constants String constants


What kind of constructs can be declared in a Java interface?

Constants and abstract methods. That's it.


What is tab in c language?

When printing text through a string, \t can be used to produce a horizontal tab. The same can also be used when parsing input.Within the C language source code, a tab is considered a white space and ignored outside string constants, provided that it does not break a keyword into two parts.


What is the definition of symbolic constants in c language?

constants are values that does not chnage through out the program exceution..


How do you write c program to accept a string from the console and count number of vowels constants digits tabs and blank spaces in a string?

Read the characters one at a time, and write an "if" for each of the cases. In each case, if the condition is fulfilled, increment the corresponding counter variable.


What is cputs function in computer c plus plus?

Nothing.The C language only recognizes a few keywords, like "for" and "if". Most of what's in a C program ... that doesn't reference routines in the C program itself ... are library calls, and cputs() is one of those. What it does is write its argument (which should be a pointer to a character string) to the console... console put string.


What are enumerations in C?

Enumerations are groups of named constants.


What type of data is held in a string?

String in C is basically a Character 1-D array, whose last character is a NULL ['\0']. It is declared as follows: char array_name[size]; Ex. char wiki[10];