a write the algorithm to concatenate two given string
Whatever you want. Concatenate them, for example.
Normally yes, but it will actually take numbers and combine them into a text string.
That really depends on the programming language. In Java, it is sufficient to concatenate it with a String: int myNumber = 5; result = "" + myNumber; Other languages may require a special function, or method, to convert from integer to string.
Language dependent. In C, for example, there no string as such, but you can use function strcat to concatenate zero-terminated character-sequences.
In MS SQL, you can use the char() operator on the column. For example: select 'some string content ' + char(integer_field) from my_table
Scanner scan = new Scanner("[input method]"); // input method could they key board //(System.in) or a String String one = scan.next() + scan.next(); // get the first 2 words and concatenate String two = scan.next(); // the remaining word
#include#includevoid main(){char a[30],b[30];clrscr();printf("Enter the string a:");gets(a);printf("Enter the string b:");gets(b);printf("%s",strcat(a,b));getch();}
"+" is the concatenation operator in Java. It can be used to concatenate two strings. Ex: String firstName = "John"; String lastName = "Morrison"; System.out.println(firstName + " " + lastName); The above code snippet would display John Morrison in the console.
String and array are not related to one another so they have many differences. a. A string is used to hold alpha numeric values inside it b. An Array is used to hold multiple values of any primitive data type c. A String has operations like equals, concatenate, substring etc whereas an array does not have them d. You can iterate through an array but we cannot iterate through a string.
strcat
The concatenate key is simply the combination of several columns in a table, which serves the unique key of that table.