Question:
C programming question - datatypes?
1970-01-01 00:00:00 UTC
C programming question - datatypes?
Seven answers:
2016-04-09 10:50:14 UTC
try this 1. int(string) 2. float(integer) 3. str(float)
Fudge
2009-04-07 22:10:59 UTC
Bud, u r right , C is very strong but it's very bad when it comes to strings .Perl is very cool when it comes to Strings manipulation ...

Strings in C are constant pointers :

char cp * = "foo";



or array of chars :

or char a [] = "bar";



or dynamically allocated memory ...



Check out this

http://www.cprogramming.com/tutorial/lesson9.html

http://cplus.about.com/od/learningc/ss/strings.htm



Very good question !
2009-04-04 11:48:22 UTC
String can saved in memory by using Array.



Other Int, float and double for numbers.



scanf function used to read data from keyboard.
2009-04-04 10:13:55 UTC
You can use a char array for strings. This library has all of the string handling functions.



http://xoax.net/comp/cpp/reference/cstring/index.php
ÑОТЙÎÑG ÍS ÏМРФSSÎВLÊ
2009-04-04 09:36:28 UTC
a string of characters can be single variable called derived datatype named 'array' which is derived from basic datatypes int, char or float. its declaration syntax is type array_name[size of array];

for eg to store an string of characters declare an array as follows, char name[10]; by this declaration an array of datatype char can used to store 10 characters in the array named name. values can be stored in many ways using scanf, gets etc. simple way is using gets function. simply write the code as follows to get values:- gets(name); refer array for more details.
honey_57
2009-04-04 09:24:07 UTC
the datatype for multiple characters is a character array..



here is a site to learn more about it..



http://www.exforsys.com/tutorials/c-language/handling-of-character-strings-in-c.html
?
2009-04-04 21:10:43 UTC
The two ways of handling character strings in C are as follows:



char* character_string;



and



char character_string[ array_length ];



In both cases, the character string has to be terminated with a null character (0 or '\0') as a signal character. Note that this isn't really a separate data type.



There are several built-in string handling functions, such as strlen(), strcpy() and strstr().



C++, being object-oriented, has actual string classes.



Hope that helps.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...