answersLogoWhite

0


Best Answer

In C Programming you would use the following:

char a[] = "abcdeabcde";

If you wish to create an array with more than one string, use an array of character pointers instead:

char* a[] = {"abcde", "fgh", "ijklm", "nopq", "rstu", "vwxyz"};

User Avatar

Wiki User

6y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you store a string of letters for example abcdeabcde each to an array?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Can you give an example of array using character variable in c program?

the example of array over charcter variables is char ["string"]


What is string array?

A string array is an array whose contents are strings.An array is when you use a single variable names to store different data items. The data items are distinguished by a number (sometimes by more than one).A string is a data type used to store texts. It may contain letters, digits, or other symbols.A string array is an array whose contents are strings.An array is when you use a single variable names to store different data items. The data items are distinguished by a number (sometimes by more than one).A string is a data type used to store texts. It may contain letters, digits, or other symbols.A string array is an array whose contents are strings.An array is when you use a single variable names to store different data items. The data items are distinguished by a number (sometimes by more than one).A string is a data type used to store texts. It may contain letters, digits, or other symbols.A string array is an array whose contents are strings.An array is when you use a single variable names to store different data items. The data items are distinguished by a number (sometimes by more than one).A string is a data type used to store texts. It may contain letters, digits, or other symbols.


Write a program to input a string in the form of name and swap the initials of the namefor example enter a string is rohit Kumar sharma and should be printed RK Sharma?

Get the string from user , then U Split the string with space and put in a string array .Then Find Length of string array , Take first letter of each element in array, Except last. Assigned those to a string, then Fetch Last element of an array, Add it With that String.That's it.


How many constructors are there for the string class?

The String class has multiple Constructors. Some of them are: 1. String - new String(String val) 2. Character Array - new String(char[] array) 3. Character Array with index positions - new String(char[] array. int start, int end)


How can you convert from int to string?

There is no one line of code that can convert an array to a different type. A new String array would have to be created and values individually inserted into the array. Example: //Assume int[] i has been previously defined String[] s = new String[i.length]; for(int i=0; i<s.length; i++) s[i] = ""+i[i];

Related questions

Can you give an example of array using character variable in c program?

the example of array over charcter variables is char ["string"]


What is string array?

A string array is an array whose contents are strings.An array is when you use a single variable names to store different data items. The data items are distinguished by a number (sometimes by more than one).A string is a data type used to store texts. It may contain letters, digits, or other symbols.A string array is an array whose contents are strings.An array is when you use a single variable names to store different data items. The data items are distinguished by a number (sometimes by more than one).A string is a data type used to store texts. It may contain letters, digits, or other symbols.A string array is an array whose contents are strings.An array is when you use a single variable names to store different data items. The data items are distinguished by a number (sometimes by more than one).A string is a data type used to store texts. It may contain letters, digits, or other symbols.A string array is an array whose contents are strings.An array is when you use a single variable names to store different data items. The data items are distinguished by a number (sometimes by more than one).A string is a data type used to store texts. It may contain letters, digits, or other symbols.


Write a program to input a string in the form of name and swap the initials of the namefor example enter a string is rohit Kumar sharma and should be printed RK Sharma?

Get the string from user , then U Split the string with space and put in a string array .Then Find Length of string array , Take first letter of each element in array, Except last. Assigned those to a string, then Fetch Last element of an array, Add it With that String.That's it.


What are array of string pointers?

An array of pointers to string would contain, per array position, a number dictating which memory address holds the string data. For example, position [0] in an array would contain a memory address. This memory address can be de-referenced to obtain the actual information held within that memory address.


What is the array of string in c?

A string in C is stored in a 1 dimension array so an array of strings is simply a two dimension array.


How many constructors are there for the string class?

The String class has multiple Constructors. Some of them are: 1. String - new String(String val) 2. Character Array - new String(char[] array) 3. Character Array with index positions - new String(char[] array. int start, int end)


How can you convert from int to string?

There is no one line of code that can convert an array to a different type. A new String array would have to be created and values individually inserted into the array. Example: //Assume int[] i has been previously defined String[] s = new String[i.length]; for(int i=0; i<s.length; i++) s[i] = ""+i[i];


How do you convert a string into a character array?

A string is, by definition, a character array. No conversion is required.


What elements are in string?

A string is an array of characters.


What is the difference between array and string of array?

When we declare an array of characters it has to be terminated by the NULL , but termination by NULL in case of string is automatic.


Can an array contain elements of an object type?

Yes. An array of arrays is nothing more than a multi-dimensional array.


No of occurrence of element in an array?

The below is an example to find the instance of a string in a string array. You can modify this to any kind of array and also pass the array and value to be checked as parameters. public class ArrayTest { /** * @param args */ public static void main(String[] args) { String[] strArr = new String[] {"One", "Two", "Three", "Four", "One"}; String txt = "One"; int size = strArr.length; int counter = 0; for(int i = 0; i < size; i++){ String temp = (String) strArr[i]; if(temp.trim().equals(txt)){ counter++; } } System.out.println("The word '" + txt + "' occurs " + counter + " Times in the array"); } } The output of this program would be: The world 'One' occurs 2 Times in the array